example-oauth2-server
example-oauth2-server copied to clipboard
Not getting refresh token in oauth/token api
I am calling /oauth/token to generate the token by passing the code. I set OAUTH2_REFRESH_TOKEN_GENERATOR=True in my flask app config. But I only get access_token in the response but not refresh_token.
@ZTAP0011 can you send your curl command? Which grant_type are you using?
Hello @lepture , I am sending authrization_code in grant type. But this is the first time we request for the oauth token and not to get a new token from a refresh token.

Are you using this demo without any change? I've just verified, this demo works fine.
Yes, I am using this to get the access and refresh token $ curl -u ${client_id}:${client_secret} -XPOST http://127.0.0.1:5000/oauth/token -F grant_type=authorization_code -F scope=profile -F code=${code}
But in response I only get access token and not the refresh token.
Did you give the refresh_token grant to the client (in addition to the authorization_code grant)?
I ran into the same problem and the reason was that Authlib refuses to even generate a refresh token if the client doesn't have the refresh_token grant. Obvious, in retrospect.