We're sorry GroupDocsCloud doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.cloud

401 Unauthorized reoccurring

Hi, Im using the groupdocs-conversion-cloud, version 21.12.
I have random and reoccurring incidents of getting “401 Unauthorized” on files that were previously fine, and with the same credentials for groupdocs.
those incident can last a few hours, and then back to normal…
is this a known issue?

@danibk

No, there is no such known issue. Please note JWT Access token has one day lifetime. So if you are consuming groupdocs cloud APIs via some rest client then you need to refresh the token yourself. However, GroupDocs Cloud SDKs refresh the token automatically.

Hopefully, it will help you to understand and resolve the issue. Otherwise, please share your sample code to reproduce the issue at our end for further investigation.

Hi Tilal, thanks for the answer.
I am using a rest client, can you tell which function I need to implement for the refresh?
also, last time this issue happened was last week, this can still be the problem? wouldn’t this happened every day is that was the issue?

@danibk

As stated in the documentation, you need to write code to handle this scenario. You can either use the expires_in value from the response to regenerate the access token or handle the “401 Unauthorized” exception. You will use same endpoint https://api.groupdocs.cloud/connect/token to regenerate the token.

{
    "access_token": "eyJhbGciOiJ.........ayLOK-GaZ8Q",
    "expires_in": 86400,
    "token_type": "Bearer"
}