Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not getting refresh token in oauth/token api #78

Open
ZTAP0011 opened this issue Feb 4, 2021 · 5 comments
Open

Not getting refresh token in oauth/token api #78

ZTAP0011 opened this issue Feb 4, 2021 · 5 comments

Comments

@ZTAP0011
Copy link

ZTAP0011 commented Feb 4, 2021

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.

@lepture
Copy link
Member

lepture commented Feb 9, 2021

@ZTAP0011 can you send your curl command? Which grant_type are you using?

@ZTAP0011
Copy link
Author

ZTAP0011 commented Feb 9, 2021

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.

image

@lepture
Copy link
Member

lepture commented Feb 9, 2021

Are you using this demo without any change? I've just verified, this demo works fine.

@ZTAP0011
Copy link
Author

ZTAP0011 commented Feb 9, 2021

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.

@joanbm
Copy link

joanbm commented Mar 11, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants