After logout, redirect the user to my own application

Hi team,

I have been using below script to lougout the user using API,

const platformClient = require("purecloud-platform-client-v2");

const client = platformClient.ApiClient.instance;
client.setEnvironment(platformClient.PureCloudRegionHosts.us_east_1); // Genesys Cloud region

// Manually set auth token or use loginImplicitGrant(...) or loginClientCredentialsGrant(...)
client.setAccessToken("your_access_token");

let apiInstance = new platformClient.TokensApi();

let userId = "userId_example"; // String | User ID

// Delete all auth tokens for the specified user.
apiInstance.deleteToken(userId)
  .then(() => {
    console.log("deleteToken returned successfully.");
  })
  .catch((err) => {
    console.log("There was a failure calling deleteToken");
    console.error(err);
  });

but once this api executed, users automatically redirected to normal Genesys url. But I don't want that, I want thhose users to be redirected to m own application url. can you please help me out here.

Thanks,
Magu

Another approach I am trying is, I am redirecting the user to

https://login.mypurecloud.com/logout?client_id=<your client id>&redirect_uri=<a registered redirect for your app>

apiInstanceForToken.deleteToken(TokenuserId).then(e => {
							console.log("delete response...", e);
							var opts = {
								method: 'post',
								url: `https://login.mypurecloud.com/logout?client_id=${CLIENT_ID}&redirect_uri=<a registered redirect for your app>`,
								//data: { 'useId': TokenuserId }
							};
							axios(opts).then(e => {
								console.log("data", e);
							}).catch(err => {
								console.log("error", err);
							})
							console.log("Token deleted...");
						})
							.catch(e => console.error(e))

It did logout the user, but still its not redirecting it to my own application.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.