Unable to use JWT TOKEN

Just got a new generated token with https://api.aspose.cloud/connect/token

When using it in my headers:
headers=
{
Authorization: "Bearer eyJhbGci
}

i receive that error when calling https://api.aspose.cloud/v4.0/barcode/recognize-multipart

“errorAuthorization”,“description”:“The issuer ‘https://api.aspose.cloud’ is invalid”

Can anyone help ?

@lgermain

It seems that you are encountering an issue with the JWT token when trying to access the Aspose API. The error message you received indicates that the issuer of the token is invalid. Here are some steps you can take to troubleshoot and resolve this issue:

  1. Token Generation: Ensure that you are generating the JWT token correctly. The token should be generated using the correct endpoint and with the appropriate credentials. Make sure you are using the correct client ID and client secret.

  2. Authorization Header: When you include the token in your request headers, ensure that the format is correct. The header should look like this:

    Authorization: Bearer <your_token_here>
    

    Make sure there are no extra spaces or characters in the token string.

  3. Token Validation: The token must be valid and not expired. You can validate the token by decoding it and checking its claims. The first part of the token (before the first dot) can be decoded from Base64 to check the header and ensure it is of type “JWT”.

  4. Correct API Endpoint: Double-check that you are calling the correct API endpoint. The endpoint you mentioned (https://api.aspose.cloud/v4.0/barcode/recognize-multipart) should be correct, but ensure that it matches the version and functionality you intend to use.

  5. Testing with Mock Requests: If you are developing in a .NET environment, consider using mock requests to test the token handling. This can help you ensure that your application correctly handles the authorization process and token refresh logic.

If you continue to experience issues, please provide more details about how you are generating the token and any additional error messages you may be receiving. This will help in diagnosing the problem further.

If you need more specific examples or code snippets, feel free to ask!

Sources:
[1]: JWTRequestHandlerTests.cs

when using base64 decode of my token: i can see:
{“alg”:“RS256”,“typ”:“JWT”}

Hello, @lgermain !
Thank you for reaching out, and apologies for any confusion caused by the automated response. For our Aspose.BarCode Cloud v4 API, you should update code to use token from https://id.aspose.cloud/connect/token instead of https://api.aspose.cloud/connect/token. This change is likely the reason for the “invalid issuer” error you’re seeing. Once you generate your new token from https://id.aspose.cloud/connect/token and include it in your Authorization: Bearer <token> header, your requests should work properly.

If you need examples or further guidance, you might find our official SDKs helpful.

Please feel free to follow up with any other questions - We’re always here to help!

Thx a lot , it works well now.

But quite confusing cause on your site it is explained that token have to be generated from https://api.aspose.cloud/connect/token

@lgermain
Thanks for the update, and I’m glad it works now. Could you please share the specific link or page where it says tokens should be generated from https://api.aspose.cloud/connect/token? We want to fix that reference in our documentation as soon as possible.