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

Can't get id_token in google oauth token #174

Open
Euphorbium opened this issue Mar 3, 2015 · 2 comments
Open

Can't get id_token in google oauth token #174

Euphorbium opened this issue Mar 3, 2015 · 2 comments

Comments

@Euphorbium
Copy link

google = OAuth2Session(client_id, redirect_uri=redirect_uri)
token = google.fetch_token(token_url, client_secret=client_secret,
                   authorization_response=google_response)

Google returns a token, that looks(prints) like this:

{u'token_type': u'Bearer', u'refresh_token': u'1/sdfsdfsfd, u'access_token': u'sdfsdfsfdsfdsfd', u'id_token': u'sdffsdfsdfsdfsdf', u'expires_in': 3600, u'expires_at': 1425417341.962704}

But I can't access the id_token. token.keys() returns [u'access_token', u'token_type', u'expires_in', u'refresh_token', u'expires_at']

Why is it like that? Is this the intended behavior?

@javdrher
Copy link

I realize this is an old issue, however today I encountered the same. google-auth however tries to obtain the id_token from the session to return credentials, which is always none. Am I doing something wrong and is the id token removed on purpose?

@singingwolfboy
Copy link
Member

It appears that the credentials are parsed using the parse_token_response() function in oauthlib, which is only looking for certain values in the response. Any other values are ignored. I'm not sure the best way to fix this -- you might need to use a compliance hook to get that id_token value.

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