Is there a error code doc for MessengerTransport SDK?

Usually, SDK providers will provide a doc for exception scenario. Can you provide a doc for error cases, please?

When integrating MessengerTransport SDK for iOS and Android, we met several authentication errors like below:

{"type":"response","class":"string","code":403,"body":"Try to authenticate again"}
{"type":"response","class":"string","code":400,"body":"Impossible to update authenticatedCustomerId"}
{"message":"Failed to identify user for token: * deploymentId: *","code":"unauthorized","status":401,"contextId":"*","details":[],"errors":[]}

It is quite hard for mobile developers to identify the root cause for these error scenarios.

Because the official doc does not explain these error details: https://developer.genesys.cloud/commdigital/digital/webmessaging/mobile-messaging/messenger-transport-mobile-sdk/getting-started

Can we get a list of such errors and possible issues / areas to investigate please?

1 Like

Hi,

Thanks for reaching out.

The errors you are reporting are not specific to SDK but rather backend errors.

1- First error is HTTP 403. It means that the token you provided has expired.
You need either to refresh it or generate a new one.

2- The second error tells you that the token you provided is valid (so authentication succeeded), but the referenced user (in this token) does not match the one previously registered for the current Webmessaging session.
Once a user is authenticated with a session, link is established and cannot be broken.
You need to start a new session if you want to use this token.

3- Third case is an un-successful authentication error (HTTP 401). No token is generated. Something went wrong.

There is a troubleshooting errors section available at the service level. Let us know if you think it lacks details.
It applies to all clients/SDKs.

Hope this helps,

Regards,
V.P.

1 Like

In fact, the above errors all occur after SDK jwt exchange, and even restarting the authenticated session cannot solve the error. Is there any way to remedy this error in mobile? thanks

https://api.euw2.pure.cloud/api/v2/webdeployments/token/oauthcodegrantjwtexchange
@vpirat

Hi @vpirat,
Thanks for the detailed reply.

Can you clarify below queries for the second item of your reply, please?

  1. Why the token is valid, but the referenced user does not match with the Webmessaging session?
  2. As for "start a new session", do you mean we need to call clearConversation to end the current conversation and then create a new conversation?

Hi,

1- This means that you authenticated with a different user (different from the one used previously).
The token contains a unique userId (sub claim in OpenID) set by the authorization server.
If the userId is different, it will fail.
2- Yes, that's a way of doing it.

Hope this helps,

Regards,
V.P.

1 Like

1- 403 is expected. All tokens have a time to live (15 minutes max).

2- 401 with different users on the same session is by design.

3- 401 on authentication can result from different root causes.
Can you provide a contextId (or correlationId) of such failing request(s) ?

Regards,
V.P.

can't find the contextID or correlationId, this error failed to configure session

{
"token": "71892f32-41ba-4e88-80b2-06d95ce2f6c9",
"startNew": false,
"journeyContext": {
"customer": {
"id": "71892f32-41ba-4e88-80b2-06d95ce2f6c9",
"idType": "cookie"
},
"customerSession": {
"id": "",
"type": "web"
}
},
"data": {
"code": "**eyJhbGciOiJSUzI1NiIsImtpZCI6ImMxYjExYTU2LWZhODQtNGRmNi1hM2VmLWM2NWVjMGU1YWMzMCIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ3ZWJtZXNzYWdpbmciLCJhdXRoX3RpbWUiOiIxNzIxMzg1MzUxIiwiZGF0YSI6eyJkaWQiOiI4MDQ0OGI1YS0zMjg5LTQ1MDktODQyNy02OTE0OGMwNGI0M2IiLCJ1dWlkIjoiNzY5MjNjNDUtMGQzMi00NDcyLTgwY2UtYmI5Z"
},
"action": "configureAuthenticatedSession"
}

return below error
{
"type": "response",
"class": "string",
"code": 400,
"body": "Impossible to update authenticatedCustomerId"
}
try to call clearConversation but still this issue
How can I retry to resolve this error?

Hi,

As previously stated, you're using a different user than the previous registered one.
Are you using always the same user ?
1/ If not, then this is the expected behavior. You cannot change users in an authenticated session.
2/ If yes, here's what you can do:

  • Authenticate with a given user by calling api/v2/webdeployments/token/oauthcodegrantjwtexchange
  • copy the JWT sent back and decode it with (using jwt.io site).
    Write down the sub attribute (see picture).
    image
  • Authenticate again with the same user.
  • copy the JWT sent back and decode it.
    Write down the sub attribute.
  • Compare both values. They must be identical.
    If they are not, then this means that the authorization is not consistent and does not send back a unique Id for the same user. This could happen (for example) with mock servers used for testing that send back random ids.
    For a given user, it is expected to have always the same sub value.

Regards,
V.P.

1 Like

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