"Refreshing an access" does not work correctly. API returns "token bad grant_type"

79 views
Skip to first unread message

Kensuke Mitsuzawa

unread,
Jun 7, 2020, 9:06:59 AM6/7/20
to Feedly Cloud
Hello.

I'm trying to solve an issue in generating new access token with refresh token. I follow a procedure written in API documentation https://developer.feedly.com/v3/auth/#refreshing-an-access-token . But the response of the API is 400 whose message is
"{"errorCode":400,"errorId":"ap3int-sv2.2020060705.3146155","errorMessage":"bad grant_type"}' .


How could I solve this issue ? 

Here is request info: 
{"client_secret": "feedlydev", "client_id": "feedlydev", "grand_type": "refresh_token", "refresh_token": "REFRESH TOKEN"}

I tried to send this request by both of "x-www-form-urlencoded" and "application/json".

And here is my python script to get the new access token.

import requests
import urllib

api_base
= 'https://cloud.feedly.com/'
api_method = 'v3/auth/token'

api_request_point = api_base + api_method
headers
= {'Content-Type': 'application/x-www-form-urlencoded'}

params = {"client_secret": "feedlydev",
         
"client_id": "feedlydev",
         
"grand_type": "refresh_token",
         
"refresh_token": "MY REFRESH TOKEN"}
params_data = urllib.parse.urlencode(params)
r = requests.post(url=api_request_point, data=params_data, headers=headers)

print(r)


My feedly plan is proStandard.

Thank you, in advance!

David Chatenay

unread,
Jun 8, 2020, 1:49:26 PM6/8/20
to Kensuke Mitsuzawa, Feedly Cloud
  Hi Kensuke,
  There is a typo in the request: the parameter name is `grant_type`, not `grand_type`.
  Hope this helps,

-- 
David Chatenay
Feedly


--
You received this message because you are subscribed to the Google Groups "Feedly Cloud" group.
To unsubscribe from this group and stop receiving emails from it, send an email to feedly-cloud...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/feedly-cloud/15a42d6e-5cb2-4da3-b2ff-ce33ba4b0de4o%40googlegroups.com.

Kensuke Mitsuzawa

unread,
Jun 8, 2020, 4:02:05 PM6/8/20
to Feedly Cloud
Hello David,

Thank you for your quick response. I feel ashamed on such trivial error ;(

I tried to rewrite request and send it to API. Yes, the response is changed. But still, there is problem. This time, I get following error in the response.

'{"errorCode":403,"errorId":"ap3int-sv2.2020060811.2916844","errorMessage":"bad refresh_token (check URL encoding)"}'

Obviously, this error shows that my refresh_token in the request is not correct. That is also written in a documentation. https://developer.feedly.com/v3/auth/
So, I try to confirm that my refresh token is correct. Here is the response when I send a request with grant_type=authorization_code

{"plan":"proStandard","provider":"Google","id":"[ID]","scope":"https://cloud.feedly.com/subscriptions","token_type":"bearer","access_token":"[ACCESS TOKEN]","expires_in":604800,"refresh_token":"[REFRESH_TOKEN]"}

I surely checked that the refresh token is correct. And it's clear that my plan is proStandard. In this situation, what would be a reason for this error?


2020年6月8日月曜日 19時49分26秒 UTC+2 david:
To unsubscribe from this group and stop receiving emails from it, send an email to feedly...@googlegroups.com.

H F.M

unread,
Aug 26, 2021, 9:29:45 AM8/26/21
to Feedly Cloud
hi Kensuke,

May I ask you to explain more how you are using  grant_type=authorization_code. When I am changing it from refresh_token to authorization_code it is showing me syntax error. 
My question is when we are assigning to refresh_token we can see only new token in the response but I saw that refresh token is changing too so I think we need to have refresh token too but I am not able to get it .
I appreciate if you can clarify how you are using authorization_code in your python code.
thanks
Reply all
Reply to author
Forward
0 new messages