How to Resolve The "Failed to decode S2S token" Error?

When someone tries to use the Fetch Stream Activity on Framework , why is the error message "Failed to decode S2S token: Not enough segments" thrown?

Issue Description:

When tried to use the Fetch Stream Activity on Framework , the error message "Failed to decode S2S token: Not enough segments" is thrown.

image.png


Resolution:

The error message indicates that there is an issue with the "Server-to-Server" (S2S) token used for authentication in the communication with Communications Mining.

Here are a few things to verify:

  1. Make sure to have the correct S2S token: Ensure using a valid token generated from Communications Mining/ UiPath Cloud. Double-check the token value and make sure there are no extra spaces or characters.
  2. Verify the token format: The S2S token should have three segments if it is a JWT format, separated by two period characters ('.'). For example: header.payload.signature. Ensure the token used follows this format.
  3. Token expiry: S2S tokens usually have a limited lifetime. Check if the token has expired, and if so, obtain a new token from Communications Mining/UiPath Cloud.
  4. Correct usage of the token: Make sure to use the token correctly as a Bearer token in the Authorization HTTP header. The header should look like: Authorization: Bearer [your_token_here].
  5. Issues in the Fetch Stream activity: Make sure the "Fetch Stream Activity" has been correctly set up and configured in UiPath Studio, including any necessary headers and authentication set up.