How to generate the fresh token in Adobe I/O Console and read in adobe campaign

raman

06-07-2020

Hi Team, I am working on a use case where I am accessing the Adobe Target API using Adobe I/O console in adobe campaign. As we know that generally when we create the token manually in Adobe I/O , it gets expired after 24 hours. In order to realistic I want a process in adobe campaign which generates a new token automatically from Adobe I/O and authentication process remain smooth. Please guide me. Currently I am using the below code where I am hardcoding the vaue of Bearer Token : var http = new HttpClientRequest("https://mc.adobe.io/techaspectamericasbx/target/activities/ab/350930"); http.method = "GET"; http.header["Content-Type"] = "application/json"; http.header["Authorization"] = "Bearer eyJ4NXUiOiJpbXNfbmExLWtleS0xLmNlciIsImFsZyI6IlJTMjU2In0.eyJpZCI6IjE1OTM3NzU3NzMzMjJfMzNhZTZjYTQtNTg0Mi00M2JmLTkxZjQtOWM5ZjQyMDZhZDljX3VlMSIsImNsaWVudF9pZCI6IjQyZjQ0NGIxMTM5YzRlZWI5ZjBhZmU0NWRjNTU5ZmFjIiwidXNlcl9pZCI6IjczOEUxMkQ4NUVFNzUxMTQwQTQ5NUU2Q0B0ZWNoYWNjdC5hZG9iZS5jb20iLCJ0eXBlIjoiYWNjZXNzX3Rva2VuIiwiYXMiOiJpbXMtbmExIiwiZmciOiJVU0lGRE1KV0ZMUDVKVjZXQzRBM1lPUUFITT09PT09PSIsIm1vaSI6IjVhOTkwOTYyIiwiYyI6ImdHYXFQMXA4em4yNVdzbFVQVlNPaWc9PSIsImV4cGlyZXNfaW4iOiI4NjQwMDAwMCIsInNjb3BlIjoib3BlbmlkLEFkb2JlSUQsdGFyZ2V0X3NkayxyZWFkX29yZ2FuaXphdGlvbnMsYWRkaXRpb25hbF9pbmZvLnJvbGVzLGFkZGl0aW9uYWxfaW5mby5wcm9qZWN0ZWRQcm9kdWN0Q29udGV4dCIsImNyZWF0ZWRfYXQiOiIxNTkzNzc1NzczMzIyIn0.aZlHvdv6ZnuO4-R6Fwgqoyoz8CJNbdwF4GFTJ-IONKYUdYlRbW2mkJrk1hGHtdpT_rQyDZknMAVgGO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