django-allauth和rest-auth Facebook登录令牌不适用于JWT身份验证 [英] django - allauth and rest-auth facebook login token does not work with JWT authentication

查看:133
本文介绍了django-allauth和rest-auth Facebook登录令牌不适用于JWT身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了这两个软件包的文档,并使用了休息验证文档。我已经完成了所有步骤,并且可以成功使用此API在Facebook中注册/登录用户。 API向我返回了令牌 user 对象,但是此令牌不适用于 JWT 身份验证。但是,如果我在数据库中设置了该用户的用户名,然后再次发布了Facebook登录请求,则返回的令牌可以正常工作。此社交身份验证过程与用户名有什么关系?我需要做些什么来正确配置它?

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.

推荐答案

在rest_framework_jwt中的1.7.0之后,使用用户名用于在authenticate_credentials()中查询用户。但是,当您使用facebook accessToken通过rest_auth首先登录时,该用户没有用户名
这样您将收到一条无效负载消息。
我也有这个问题。现在我要做这项工作。
对不起,我的英语水平很差。

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.

这篇关于django-allauth和rest-auth Facebook登录令牌不适用于JWT身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆