PHP Classes

Invalid grant_type refresh_token

Recommend this page to a friend!

      PHP OAuth Library  >  All threads  >  Invalid grant_type refresh_token  >  (Un) Subscribe thread alerts  
Subject:Invalid grant_type refresh_token
Summary:Invalid grant_type refresh_token
Messages:5
Author:dhaivat naik
Date:2021-06-11 10:54:21
 

  1. Invalid grant_type refresh_token   Reply   Report abuse  
Picture of dhaivat naik dhaivat naik - 2021-06-11 10:54:21
Trying to use it for AdobeSign. In the oauth_configuration.json file below are the settings

"Adobesign":
{
"oauth_version": "2.0",
"dialog_url": "https://secure.in1.echosign.com/public/oauth?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&scope={SCOPE}&state={STATE}",
"access_token_url": "https://secure.in1.echosign.com/oauth/token",
"grant_type": "authorization_code"
}

Authentication works without any problem. But the token expires and when it tries to fetch the refresh token it gives the error message "Invalid grant_type refresh_token".
After debugging, I found that to refresh the token, the url is 'https://secure.in1.echosign.com/oauth/refresh'

The application has 2 URLs
- access token url: https://secure.in1.echosign.com/oauth/token
- refresh token url: https://secure.in1.echosign.com/oauth/refresh

How can I provide the refresh token url?

  2. Re: Invalid grant_type refresh_token   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-08-13 03:08:57 - In reply to message 1 from dhaivat naik
Hello dhaivat,

Sorry I missed this message. Do you still need help?

  3. Re: Invalid grant_type refresh_token   Reply   Report abuse  
Picture of dhaivat naik dhaivat naik - 2021-08-13 05:02:10 - In reply to message 2 from Manuel Lemos
I have debugged and made some tricks, not sure if that is correct or not, but that works for me.
In the oauth_client.php function ProcessToken2 after line number 2090

if(!$this->GetAccessTokenURL($access_token_url))
return false;
after this statement i have added below code
if($refresh){
$access_token_url = str_replace('/oauth/token', '/oauth/refresh', $this->access_token_url);
}
So ultimately I am changing the access token URL from /oauth/token to /oauth/refresh

Let me know if this is incorrect or can be done in a better way. At the moment after this change, it works for me.

  4. Re: Invalid grant_type refresh_token   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-08-13 05:45:54 - In reply to message 3 from dhaivat naik
Hello Dhaivat,

OK, I think I can add a new configuration option to set a refresh URL that is different from the access token URL.

Can you tell me what is the OAuth server that you are using so I can try to test the change to make it work with that server?

  5. Re: Invalid grant_type refresh_token   Reply   Report abuse  
Picture of dhaivat naik dhaivat naik - 2021-08-13 06:50:37 - In reply to message 4 from Manuel Lemos
oAuth Server is Adobesign

"Adobesign":
{
"oauth_version": "2.0",
"dialog_url": "https://secure.in1.echosign.com/public/oauth?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&scope={SCOPE}&state={STATE}",
"access_token_url": "https://secure.in1.echosign.com/oauth/token",
"grant_type": "authorization_code"
}