Citrix: Bad Request on refreshing the access token for ShareFile

345 Views Asked by At

We have been using ShareFile API for downloading the Citrix Attachment. We are using Oauth 2.0. The general flow is - our clients will authorize the our Citrix ShareFile App to grant permission for accessing their files. OUr ShareFile app should already have the required permission\scopes because with the same app we are successfully downloading attachment files of our customers. However, we are having some problem with a client.

When we tried to get Share items of this client with the access token, we are getting the following error:

Request:

https://clientdomainname.sf-api.com/sf/v3/Shares(se552cbfffda144619419696b8b12f88b)/Items

Response: {

"code": "Unauthorized",

"message": {

    "lang": "en-US",

    "value": "You must log in to view this link."

},

"reason": "NotAuthenticated"

}

And when we tried to refresh the access token, we got the Bad Request (error code 400) with invalid_grant error using the refresh token

Request:

https://clientdomanname.sharefile.com/oauth/token

Response:

{

"error": "invalid_grant"

}

Any help would be highly appreciated!

1

There are 1 best solutions below

0
On

I encountered the same issue and finally made it work. When getting the refresh token you have to request to

POST https://<clientdomainname>.sharefile.com/oauth/token

with the following data in x-www-form-urlencoded

grant_type=refresh_token
refresh_token=<refreshToken>
client_id=<clientId>
client_secret=<clientSecret>

Here is an example using Postman App https://drive.google.com/file/d/1LiPhjADYiXbnVfHqQICtUx2Xpl7bVbNE/view?usp=sharing

You can read the API docs of ShareFile here https://api.sharefile.com/gettingstarted/oauth2

I hope this helps