google oauth - Django Rest Framework + Ember.js + rest auth -


we're building site using ember frontend app interacts our django rest framework api backend. social authentication we're using django_rest_auth coupled django-allauth. site working, except we've run problems social authentication. our local account authentication/registration working fine.

i've made many projects use django-allauth, first time using restful authentication system. ember application able go , fetch token google fine. response like:

{     authorizationcode: "mytoken12345",      provider: "google-oauth2",      redirecturi: "http://localhost:4200/dashboard" } 

i post access_token endpoint i've set according django_rest_auth docs. post /auth/google {access_token:} error returned google says "invalid credentials". how can invalid credentials after authenticating google , receiving token?

after debugging through code, found getting response https://www.googleapis.com/oauth2/v1/userinfo during complete_login function in allauth.socialaccount.providers.google.views.googleoauth2adapter class.

it's trying run https://www.googleapis.com/oauth2/v1/userinfo?access_token=mytoken12345&alt=json returning invalid credentials.

{

error: {     errors: [     {         domain: "global",         reason: "autherror",         message: "invalid credentials",         locationtype: "header",         location: "authorization"     }     ],         code: 401,         message: "invalid credentials"     } 

}

i'm pretty stumped on go here. have pointers on why happening? other code/errors can give helpful?

it turned out weren't using correct token. using authorizationcode, used in request receive token.


Comments

Popular posts from this blog

SQL php on different pages to Insert (mysqli) -

php - How can an email be returned from Stripe Checkout? -

sql - Partition elimination in Greenplum -