django - allauth and rest-auth facebook login token does not work with JWT authentication

淺唱寂寞╮ 提交于 2019-12-23 05:38:05

问题


I've followed the both packages documentations and using example from rest-auth doc. I've followed all the steps and I can successfully use this API to register/login user with facebook. API returns me token and user object but this token is not working with JWT authentication. But if I set this user's username in the db and then post the facebook login request again then returned token works fine. What does this social authentication process has to do with username? Is there something I need to do to properly configure it?

I am using custom user model and have both username and email for authenticating users. Please let me know if any further info is needed for figuring out the problem.


回答1:


after 1.7.0 in rest_framework_jwt,it use username to query user in authenticate_credentials().But when you use facebook accessToken to login firstly by rest_auth, the user doesn't have a username. So you will recieve a 'Invalid payload.' message. I have this problem too.And I do this work now. Sorry for my bad English skill.



来源:https://stackoverflow.com/questions/46982435/django-allauth-and-rest-auth-facebook-login-token-does-not-work-with-jwt-authe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!