401 with loginClientCredentialsGrant

Hi,

We're using the platform SDK on a node app - we're using loginClientCredentialsGrant

After successfully making some requests, some time later we begin to see 401 errors.

Should we be looking for expired tokens and refreshing them or is this refresh mechanism built into the client?

Thanks

Hi

You are using loginClientCredentialsGrant and we have refresh token mechanism built in the client SDK . So whenever you have 401 it will look out for the expired tokens and try to refresh them. But you need to set the this.refresh_access_token = true; for your 'Configuration' instance. Hope this helps.

Hi Hemanth,

Thanks for the response, I'm Jame's colleague.

Debugging the code for purecloud-platform-client-v2 the auth request made by loginClientCredentialsGrant does not receive a refresh token in the response (see screenshot), so the subsequent code that tries to refresh the token fails.

Hi Lucas and James.

you are right. As the snaspshot shot shows the refreshtoken will not be set for loginClientCredentialsGrant. It is available for auth grants. loginCodeAuthorizationGrant.

For loginClientCredentialsGrant if your token is expired , you need to rerun the login function to get a new token exactly like how you got it the first time

BR
Hemanth

1 Like

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