Thursday, 15 December 2022
  1 Replies
  1.2K Visits
  Subscribe
Hello

I would like to obtain a Refresh Token during authentication.

Your docs for TsgcHTTP_OAuth2_Client state that if an Authroization Type of auth2Code is used, an access token and a refresh token will be returned upon authorization. Is this true? When I examine the Refresh_Token parameter of OnAfterAccessToken it is always an empty string, at least for Dropbox.

So far, I have found that OnAfterRefreshToken is not triggered as a result of calling TsgcHTTP_OAuth2_Client.Start. In OnAfterRefreshToken, if I add a call to TsgcHTTP_OAuth2_Client.Refresh passing either the empty Refresh_Token parameter or '""' the result is a 400 Bad Request error.

Is there a way to get a Refresh Token?

Thanks

David
1 year ago
·
#1345
Hello,

The refresh token is used if the server returns a refresh token in the JSON Access Token response, you can check if Dropbox server returns a refresh token, just search for the fieldname: "refresh_token". If this field exists, the refresh token will be used. You can enable the log file in the client and check if this field is returned.
Refresh token is not mandatory so some servers doesn't implement this feature.
Find below an example of response with refresh token (from Google servers)


{
"access_token": "ya29.a0AX9GBdXsdfffhDsF8RyU3wyeDj3rxvGwxQTLz8N20kTf6a9yf3rRNLi7e-Xp86JGiZ7qhqagA3m1jRFQHk7_-I5MsDFgmd4HFdHpPoip6FNTgfLIP6lVQy9vOVssm9g6VHvCI2LcRkMbcbuRiJGQAUWa-vOaCgYKAX8SARESFQHUCsbCQbQK9HEvWpV4jcSkWJxCYA0163",
"expires_in": 3599,
"refresh_token": "1//03gHdzwIFl08SCgYIARAAGAMSNss-L9IrQko6NSkwaAVUWI9Zcdo0x9Peeq9M_oqkuM2hcWaMP1SucuEmcYAKj-8v59ECv0",
"scope": "https://mail.google.com/",
"token_type": "Bearer"
}


Kind Regards,
Sergio
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf,pas,dfm,dpr,dproj,dpk
· Insert · Remove
  Upload Files (Maximum 10MB)