问题标签 [dj-rest-auth]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 使用自定义序列化程序进行冰壶 dj-rest-auth 登录返回 HTTP 500 错误
冉:
我尝试通过以下方式测试登录端点:
curl -X POST -F "email=test@test.com" -F "password=password" http://127.0.0.1:8000/dj-rest-auth/login/ > result;
注意:myFixtures.json 有这样一个 endUser 和这些字段。
返回结果:
我认为这与我的custom_dj_rest_auth_serializers.py
. 它基于标准序列化程序:https ://github.com/iMerica/dj-rest-auth/blob/master/dj_rest_auth/serializers.py
使用默认序列化程序没有同样的问题。但是我系统的EndUser
实体没有username
. 我想我不知道如何自定义可能导致此问题的序列化程序。
BackendApp.custom_dj_rest_auth_serializers.py:
设置.py:
python - 如何使用“dj_rest_auth”让“使用 Google 登录”工作?
我正在尝试使用DRF
and实现 Google 登录dj_rest_auth
。
我已经使用 Google 作为提供者设置了“django-allauth”,并且登录过程在网络浏览器中运行。
我需要将一个 android 应用程序与我的后端连接。我创建了需要身份验证的 API 端点。
根据文档,code
完成身份验证和接收令牌是必需的。
经过一番研究,我发现code
required bydj_rest_auth
可以通过访问获得:
但是,即使在code
查询参数中返回后(从 URL 格式解码后),也会显示以下错误:
要查看是否可以使用最近的access
令牌登录,我使用我的 Google 帐户从主页登录,从管理部分复制access
令牌并将其提交到端点http://localhost:8000/dj-rest-auth/google/
。我能够收到由dj_rest_auth
.
code
我需要通过在发布请求中提供来获取身份验证令牌的帮助。
我的代码:
参考:
使用 dj-rest-auth #220 进行 Google 社交身份验证
请帮我。
python - AttributeError:模块“BackendApp.views.GoogleLogin”没有属性“as_view”
我有来自 url.py 的这个错误,这很奇怪,因为我在 Google 部分遵循本指南https://dj-rest-auth.readthedocs.io/en/latest/installation.html。我很确定我拥有所有相关设置,并且我复制了url.py
和的代码GoogleLogin.py
。有没有人知道如何处理这个问题?
网址.py
BackendApp.views.GoogleLogin.py
settings.py 代码片段
python - 如何覆盖 dj-rest-auth 注册的 SocialLoginSerializer?
我的系统使用自定义用户实体,我需要在 SocialLoginSerializer 中创建该实体。
这里似乎没有提到: https ://dj-rest-auth.readthedocs.io/en/latest/configuration.html 我尝试在settings.py中添加
虽然我可以做邮递员,但它使用的是默认的 SocialLoginSerializer。我需要做额外的工作,因为我使用了定制的。
任何帮助是极大的赞赏
我自定义的 SocialLoginSerializer.py (来自 dj-rest-auth 的原始源代码)
编辑:
网址.py
谷歌登录.py
我尝试制作一个SocialLoginView
使用SocialLoginSerializer
. 我的GoogleLoginView
用途SocialLoginView
。
python - PasswordResetConfirmView.py 是否自动填充 uid 和令牌?
该视图肯定不会出现在我的最后,但演示模板文件夹中的password_reset_confirm.html似乎可以做到这一点。
password_reset_confirm_form.html
任何帮助表示赞赏。
网址.py
编辑:也许这里的网页与 dj-rest-auth 演示文件夹中的页面不同...