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

OAuth2InputSerializer optional code #128

Open
jurecuhalev opened this issue Jun 24, 2020 · 6 comments
Open

OAuth2InputSerializer optional code #128

jurecuhalev opened this issue Jun 24, 2020 · 6 comments

Comments

@jurecuhalev
Copy link

I want to use google-plus backend, that allows to authenticate with id_token [0]. But currently serializer for OAuth2InputSerializer [1] requires code param, which breaks this server-side auth flow. This is needed for Google Sign In process on Android (https://developers.google.com/identity/sign-in/web/backend-auth).

Would it be possible to make code optional parameter to OAuth2InputSerializer? I can make a small PR that adds required=False to it.

[0] https://github.com/python-social-auth/social-core/blob/fca33317dfd29f14b060d21d0af1ab9b9de3a0a1/social_core/backends/google.py#L129
[1] https://github.com/st4lk/django-rest-social-auth/blob/master/rest_social_auth/serializers.py#L12

@jurecuhalev
Copy link
Author

After studying this a bit more, it seems like it could open new attack vectors (as google-plus doesn't check aud response for allowed clients). So maybe it isn't such a good idea to have it open by default.

@larcho
Copy link

larcho commented Jul 17, 2020

@gandalfar what other way do you suggest validation Google Sign In on iOS or Android. I found this to be the only way, using id_token instead of code since you're not provided with a private key for the code.

@jurecuhalev
Copy link
Author

I agree, I don't think there's a different way. It would be good to open a ticket against google-plus upstream backend, to add support for aud checking.

@larcho
Copy link

larcho commented Jul 18, 2020

I've looked at the source very superficially, doesn't the GooglePlus Backend retrieve user information from the Google API? (I know it's present in the JWT token itself, but I'm under the impression that it does contact the Google API for something).

@jurecuhalev
Copy link
Author

It does, but it doesn't verify token integrity: https://developers.google.com/identity/sign-in/web/backend-auth#verify-the-integrity-of-the-id-token , as far as I could see. See also the red warning at the end of here: https://developers.google.com/identity/sign-in/web/backend-auth#calling-the-tokeninfo-endpoint

@larcho
Copy link

larcho commented Jul 18, 2020

Right. Otherwise I could use any ClientID to authenticate.

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

2 participants