example-oauth2-server icon indicating copy to clipboard operation
example-oauth2-server copied to clipboard

Problem: how to refresh access token with curl command

Open newthis opened this issue 3 years ago • 4 comments

I have got the access token, so how I refresh it with my refresh_token, what is the correct curl command to get that ?

newthis avatar Nov 17 '22 03:11 newthis

My command is : curl -u a2joef57Z67mdPjKbrgct5Bt:r97JqZJknNF7FMhWBWJXeRTp1mDqdxVeuG7JzjvI2QfrRTHZ -XPOST http://127.0.0.1:5008/oauth/token -d '{"grant_type": "refresh_token", "scope":"profile","refresh_token":"azUoo2nwHX1vEU1YeLYVijkynaPfnojXyKiJ5TXLP7w9MfzD"}

response is: {"error": "unsupported_grant_type"}

newthis avatar Nov 17 '22 04:11 newthis

authorization = AuthorizationServer(
query_client=query_client,
save_token=save_token,
)
authorization.register_grant(grants.ImplicitGrant)
authorization.register_grant(grants.ClientCredentialsGrant)
authorization.register_grant(AuthorizationCodeGrant, [CodeChallenge(required=True)])
authorization.register_grant(PasswordGrant)
authorization.register_grant(RefreshTokenGrant),

the code shows that RefreshTokenGrant has been registered.

newthis avatar Nov 17 '22 04:11 newthis

Please make sure your register client supports refresh_token grant type.

lepture avatar Nov 18 '22 15:11 lepture

yes, I have added this kind of grant type in page, it still does not work.

t1

t2

newthis avatar Nov 21 '22 04:11 newthis