简体   繁体   English

使用django-oauth-toolkit进行用户身份验证

[英]User authentication using django-oauth-toolkit

I am new to OAuth and Django Rest Framework. 我是OAuth和Django Rest Framework的新手。 I have created a user model in django, now I want to use it on my native mobile application. 我已经在Django中创建了一个用户模型,现在我想在本机移动应用程序上使用它。 So, how do i create authentication using OAuth. 因此,如何使用OAuth创建身份验证。 What flow should I use? 我应该使用什么流量? Do i need to create a client application for every user? 我需要为每个用户创建一个客户端应用程序吗? Please help me with it or provide a nice tutorial. 请帮助我或提供一个不错的教程。 I have read the documentation of django-oauth-toolkit. 我已经阅读了django-oauth-toolkit的文档。 I have understood the basics, but did not understand the implementation. 我了解基本知识,但不了解执行情况。

Follow official django oauth toolkit docs Click Here 关注django oauth官方工具包文档单击此处

Install with pip 用pip安装

pip install django-oauth-toolkit

Add oauth2_provider to your INSTALLED_APPS 将oauth2_provider添加到您的INSTALLED_APPS

INSTALLED_APPS = (
    ...
    'oauth2_provider',
)

If you need an OAuth2 provider you'll want to add the following to your urls.py 如果您需要OAuth2提供程序,则需要将以下内容添加到urls.py中

urlpatterns = [
    ...
    url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
]

then Create an OAuth2 Client Application by using client_id and client_secret 然后使用client_id和client_secret创建一个OAuth2客户端应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有 oAuth2 的 Django DRF 使用 DOT (django-oauth-toolkit) - Django DRF with oAuth2 using DOT (django-oauth-toolkit) 如何使用Django-oauth-toolkit进行身份验证,使用Django-rest-framework测试API端点 - How to test an API endpoint with Django-rest-framework using Django-oauth-toolkit for authentication 在Django 2.x中使用django-oauth-toolkit - Using django-oauth-toolkit with Django 2.x Django + django-oauth-toolkit 上的迁移错误 - Migration error on Django + django-oauth-toolkit django-oauth-toolkit:自定义身份验证响应 - django-oauth-toolkit : Customize authenticate response 使用 django-oAuth-toolkit 授权代码流程授权客户端时出现问题 - Problem authorizing client with django-oAuth-toolkit Authorization Code flow 版本冲突 django-oauth-toolkit>0.12.0 和 idna==3.1 - Version conflict django-oauth-toolkit>0.12.0 and idna==3.1 允许django-oauth-toolkit发出jwt而不是随机字符串 - allowing django-oauth-toolkit to issue jwt instead of random strings 版本冲突 django-oauth-toolkit>0.12.0 和 urllib3==1.25.11 - Version conflict django-oauth-toolkit>0.12.0 and urllib3==1.25.11 在 client_credentials 模式下 Django-Rest-Framework 和 Django-Oauth-Toolkit 出现 403 错误 - 403 error with Django-Rest-Framework and Django-Oauth-Toolkit in client_credentials mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM