dj-rest-auth
dj-rest-auth copied to clipboard
Get user token after social authentication
Hey there. I have a JavaScript client app where I am able to authenticate my users and send the access_token to the Django app. With dj-rest-auth
I am successfully registering my users and I get this response:
{
"data":
{
"type":"FacebookLogin", "id":"54b777180f8303bbb63ebf91a73e9cfef47e4e4f",
"attributes":{"key":"54b777180f8303bbb63ebf91a73e9cfef47e4e4f"}
}
}
But to access my protected views in the backend I need to send a token back to the server like this:
Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b
I couldn't figure out how to use the response above to get the user token. How to get the access_token that I need to send to the server when authenticating users with Facebook or Google provider?
I suppose that "key":"54b777180f8303bbb63ebf91a73e9cfef47e4e4f" is the token that you need to include into the header to access protected backend endpoints.