omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Facebook login popup from Angular + JWT + DRF #1121

Open gnud opened 5 years ago

gnud commented 5 years ago

I am having an Angular SPA based frontend and it's server via localhost:4200 (for development), and has proxy for /api at api.mybackend.local. I am using DRF token authentication having Authentication Token bearer. However, the user is always AnonoymousUser since I can't pass the header via a popup window. Also it crashes with state invalid.

Any solution how can I use a popup window to use the social:begin having the Token authentication instead of session? I was researching the season and I found the DjangoStrategy, but don't know if I need to change something there in order to use a token, meanwhile, I made custom authentication that intercepts the token via GET param and logs the users, but I it's not working.

Also, I have a custom subclasses Facebook provider in order to have different permissions, cause I am having one facebook app for one set of users and second app for different set of users.

4 solutions I come up with: