javascript - Google oauth2 with google plus: authenticate with backend server -


i using following tutorial sign in user on client side using javascript: https://developers.google.com/+/web/people/

the code given on webpage works fine, want obtain access_token of logged in user, can send django backend authenticate user. can access token monitoring network requests using google chrome browser, don't understand how can token programmatically.

i saw post didn't help: https://developers.google.com/identity/sign-in/web/backend-auth

if use piece of code:

function onsignin(googleuser) {   var id_token = googleuser.getauthresponse().id_token;   ... } 

with code on first link, not called. appreciated!

here gist of solution:

https://gist.github.com/nikssardana/4739f700961cbcf2d2e31afdcfa8a143

after many attempts, realized sending id_token instead of access_token. google documentation says should send id_token authentication backend, reason social_django accepts access_token.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -