Skip to content

Google authDataManager is not validating access_tokens correctly #2290

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

Closed
cipiripper opened this issue Jul 15, 2016 · 12 comments
Closed

Google authDataManager is not validating access_tokens correctly #2290

cipiripper opened this issue Jul 15, 2016 · 12 comments

Comments

@cipiripper
Copy link
Contributor

Issue Description

Google authDataManager is not validating access_tokens correctly. It validates them on correct endpoint, but with wrong url param, id_token instead of access_token. See this in code here.

So you are never able to validate a token, even if it is a valid one.

How it should be done

Here is the link on google docs that says that token to be validated should be passed on access_token URL parameter.

I'll create a pull request for this issue.

@flovilmart
Copy link
Contributor

It seems that we'd need both, with id_token and access_token. Can you take that into account?

@cipiripper
Copy link
Contributor Author

Sure. But are you sure about id_token being used? Is that used for some different kind of tokens?

@flovilmart
Copy link
Contributor

Yes I'm pretty sure about that: #2023 (see the docs and notes)

@cipiripper
Copy link
Contributor Author

cipiripper commented Jul 15, 2016

I see, "id_tokens" is used for Android clients... Okay.

@flovilmart
Copy link
Contributor

Yeah, that's painful this doc... Now I'm worried that people send their 'id_token' as 'access_token' and that it may lead to a breaking change...

@cipiripper
Copy link
Contributor Author

cipiripper commented Jul 18, 2016

@flovilmart One relatively off topic question (so I do not post new issue). Shouldn't user._linkWith() generate a sessionToken when passed a valid authData? I mean, work the same as user.login().

I'm calling this in cloud code, and I am trying to allow users to login using username:password or their google account...

@flovilmart
Copy link
Contributor

If you are already logged in, you should have a session token already, and we regenerate the tokens only when re-setting the passwords.

@hslorenzo
Copy link

hslorenzo commented Oct 17, 2016

This line: return request("tokeninfo?id_token="+authData.access_token)causes "code: 101, message: Google auth is invalid for this user." error.

Trying this https://www.googleapis.com/oauth2/v3/tokeninfo?id_token="123XYZ" on a browser gives "error_description": "Invalid Value"

This should be changed to return request("tokeninfo?access_token="+authData.access_token) which gives the right response from the Google Authorization Server.

@flovilmart
Copy link
Contributor

Both are valid, depending where your token is coming from 6415a35

@flovilmart
Copy link
Contributor

@hslorenzo @cipiripper I've submitted a PR, if you wanna use id_token validation, you can use the id_token property instead of the access_token. If access_token validation fails, it will try the id_token validation for backwards compatibility.

@flovilmart
Copy link
Contributor

Man, this google API is maddening...

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