{"id":10266,"date":"2020-06-08T00:34:47","date_gmt":"2020-06-07T15:34:47","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=10266"},"modified":"2020-06-14T22:22:04","modified_gmt":"2020-06-14T13:22:04","slug":"django-django-rest-auth-nuxt-js-auth-module-%e3%81%a7%e4%bd%9c%e3%82%8b-spa-jwt-oauth-%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3%e3%82%b7%e3%82%b9%e3%83%86%e3%83%a0-%e3%81%9d%e3%81%ae%ef%bc%92","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=10266","title":{"rendered":"Django django-rest-auth + Nuxt.js auth-module \u3067\u4f5c\u308b SPA JWT OAuth \u30ed\u30b0\u30a4\u30f3\u30b7\u30b9\u30c6\u30e0 \u305d\u306e\uff12"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10293\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt1.png\" alt=\"\" width=\"536\" height=\"220\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt1.png 536w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt1-300x123.png 300w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><\/p>\n<p>\u3069\u3082\u3067\u3059\u3002<\/p>\n<p>\u524d\u56de\u306e\u300c<a href=\"https:\/\/www.webcyou.com\/?p=10264\">Django django-rest-auth + Nuxt.js auth-module \u3067\u4f5c\u308b SPA JWT OAuth \u30ed\u30b0\u30a4\u30f3\u30b7\u30b9\u30c6\u30e0 \u305d\u306e\uff11<\/a>\u300d\u306e\u7d9a\u304d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Django\u306eNuxt.js\u3082\u305d\u3046\u3067\u3059\u304c\u3001\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u6d3b\u7528\u3057\u3064\u3064\u3001\u6975\u529b\u8a18\u8ff0\u306e\u5c11\u306a\u304f\u3059\u3080\u3088\u3046\u306b\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u65e9\u901f\u00a0Django django-rest-auth\u3067 OAuth\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306bAPI\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h4>\u30d0\u30fc\u30b8\u30e7\u30f3<\/h4>\n<ul>\n<li>django 2.2.13<\/li>\n<li>python 3.7<\/li>\n<\/ul>\n<h4>\u4f7f\u7528\u30d1\u30c3\u30b1\u30fc\u30b8<\/h4>\n<ul>\n<li>djangorestframework 3.10.3<\/li>\n<li>django-allauth<\/li>\n<li>django-rest-auth<\/li>\n<li>djangorestframework-jwt<\/li>\n<\/ul>\n<p>\u5b8c\u6210\u30bd\u30fc\u30b9\u3092\u5148\u306b\u898b\u305f\u3044\u65b9\u306f\u3001\u3053\u3061\u3089\u304b\u3089<\/p>\n<p><strong>GitHub<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/webcyou-org\/simple-rest-login-server\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/webcyou-org\/simple-rest-login-server<\/a><\/p>\n<h4>\u74b0\u5883\u4f5c\u6210<\/h4>\n<p>\u307e\u305a\u306f\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ mkdir simple-rest-login-server && cd simple-rest-login-server<\/pre>\n<p>\u4eee\u60f3\u5316\u74b0\u5883\u3092\u958b\u59cb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ python3 -m venv venv\r\n$ source venv\/bin\/activate<\/pre>\n<p>pipenv\u7528\u3044\u3066\u3001\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ pipenv install django==2.2.10 djangorestframework==3.10.3 django-allauth django-rest-auth djangorestframework-jwt<\/pre>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u5206\u5225\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u5206\u304b\u308a\u3084\u3059\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u69cb\u6210\u306b\u3059\u308b\u305f\u3081\u3001\u300c<strong>config<\/strong>\u300d\u3068\u3044\u3046\u540d\u524d\u3067startproject\u30b3\u30de\u30f3\u30c9\u3067\u30e2\u30b8\u30e5\u30fc\u30eb\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>startapp\u3067\u306f\u300c<strong>accounts<\/strong>\u300d\u306e\u540d\u524d\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ django-admin startproject config .\r\n$ python manage.py startapp accounts<\/pre>\n<h4>config\/settings\u4fee\u6b63<\/h4>\n<h5>INSTALLED_APPS app\u8ffd\u52a0<\/h5>\n<p>\u300c<strong>config\/settings.py<\/strong>\u300d\u3092\u4fee\u6b63\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001django-allauth\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u8ffd\u52a0\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>config\/settings.py<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">'django.contrib.sites',\r\n'rest_framework',\r\n'rest_framework.authtoken',\r\n'rest_auth',\r\n'rest_auth.registration',\r\n'allauth',\r\n'allauth.account',\r\n'allauth.socialaccount',\r\n'allauth.socialaccount.providers.google'<\/pre>\n<p>\u300callauth.socialaccount.providers.\u3007\u3007\u3007\u3007\u300d\u306f\u3001\u5229\u7528\u3057\u305f\u3044provider\u6bce\u306b\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u300c<strong>Google<\/strong>\u300d\u306e\u307f\u8ffd\u52a0\u3059\u308b\u5f62\u3067\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>TEMPLATES<\/strong>\u306e\u7b87\u6240\u306b\u306f\u3001\u4ee5\u4e0b\u3092\u8ffd\u52a0<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">'DIRS': &#x5B;os.path.join(BASE_DIR, 'templates')],<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">TEMPLATES = &#x5B;\r\n\u00a0\u00a0\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'BACKEND': 'django.template.backends.django.DjangoTemplates',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'DIRS': &#x5B;os.path.join(BASE_DIR, 'templates')],\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'APP_DIRS': True,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'OPTIONS': {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'context_processors': &#x5B;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'django.template.context_processors.debug',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'django.template.context_processors.request',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'django.contrib.auth.context_processors.auth',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'django.contrib.messages.context_processors.messages',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0],\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0},\r\n\u00a0\u00a0\u00a0\u00a0},\r\n]<\/pre>\n<h5>AUTHENTICATION_BACKENDS<\/h5>\n<p>AUTHENTICATION_BACKENDS\u306f\u3001<\/p>\n<p>\u300c\u2019django.contrib.auth.backends.ModelBackend\u2019\u300d<\/p>\n<p>\u300c\u2019allauth.account.auth_backends.AuthenticationBackend\u2019\u300d\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u7ba1\u7406\u753b\u9762\u306f\u30e6\u30fc\u30b6\u30fc\u540d\/\u30d1\u30b9\u30ef\u30fc\u30c9\u3067\u8a8d\u8a3c\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">AUTHENTICATION_BACKENDS = (\r\n\u00a0\u00a0\u00a0\u00a0'django.contrib.auth.backends.ModelBackend',\r\n\u00a0\u00a0\u00a0\u00a0'allauth.account.auth_backends.AuthenticationBackend',\r\n)<\/pre>\n<h5>REST_FRAMEWORK<\/h5>\n<p>DEFAULT_PERMISSION_CLASSES\u306f\u300crest_framework.permissions.IsAuthenticated\u300d<\/p>\n<p>DEFAULT_AUTHENTICATION_CLASSES\u306f\u300crest_framework.authentication.TokenAuthentication\u300d\u3068<\/p>\n<p>\u300crest_framework_jwt.authentication.JSONWebTokenAuthentication\u300d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>DEFAULT_AUTHENTICATION_CLASSES \u306e\u6307\u5b9a\u306f\u3001<\/p>\n<p>\u300crest_framework_jwt.authentication.JSONWebTokenAuthentication\u300d\u306e\u307f\u3067\u5927\u4e08\u592b\u306a\u306e\u304b\u3068\u601d\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001<\/p>\n<p>\u3069\u3046\u3082\u3046\u307e\u304f\u884c\u304b\u305a\u3001\u30cf\u30de\u3063\u305f\u7d50\u679c\u3001\u300crest_framework.authentication.TokenAuthentication\u300d\u3082\u6307\u5b9a\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u56de\u907f\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">REST_FRAMEWORK = {\r\n    'DEFAULT_PERMISSION_CLASSES': &#x5B;\r\n        'rest_framework.permissions.IsAuthenticated',\r\n    ],\r\n    'DEFAULT_AUTHENTICATION_CLASSES': (\r\n        'rest_framework.authentication.TokenAuthentication',\r\n        'rest_framework_jwt.authentication.JSONWebTokenAuthentication'\r\n    )\r\n}<\/pre>\n<h5>\u30a2\u30ab\u30a6\u30f3\u30c8\u5468\u308a\u306e\u8a2d\u5b9a<\/h5>\n<p># 1: \u8a8d\u8a3c\u2f45\u5f0f\u3092 \u300c\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u300d \u306b\u5909\u66f4\u3057\u30e6\u30fc\u30b6\u30fc\u540d\u306f\u4f7f\u2f64\u3057\u306a\u3044\u8a2d\u5b9a\u306b\u3057\u307e\u3059\u3002<br \/>\n# 2: django-allauth\u306b\u5fc5\u8981\u8a18\u8ff0<br \/>\n# 3: \u30bb\u30c3\u30b7\u30e7\u30f3\u3067\u306e\u30ed\u30b0\u30a4\u30f3\u7121\u52b9\u5316\u3001cors origin \u6709\u52b9\u5316<br \/>\n# 4: \u30e6\u30fc\u30b6\u30fc\u767b\u9332\u6642\u306b\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u78ba\u8a8d\u3002\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u753b\u9762\u3067\u306bEmail\u3092\u5fc5\u9808\u9805\u76ee<br \/>\n# 5: JWT\u3067\u306e\u8a8d\u8a3c\u304c\u3067\u304d\u308b\u3088\u3046\u3068\u3001\u30c8\u30fc\u30af\u30f3\u306e\u6709\u52b9\u671f\u9650\u306e\u8a2d\u5b9a\uff08\u958b\u767a\u74b0\u5883\u306a\u306e\u3067\u53d6\u308a\u6562\u3048\u305a\u671f\u9650\u306a\u3057\uff09<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"># 1\r\nACCOUNT_AUTHENTICATION_METHOD = 'email'\r\nACCOUNT_USERNAME_REQUIRED = False\r\n\u00a0\r\n# 2\r\nSITE_ID = 1\r\n\u00a0\r\n# 3\r\nREST_SESSION_LOGIN = False\r\nCORS_ORIGIN_ALLOW_ALL = True\r\n\u00a0\r\n# 4\r\nACCOUNT_EMAIL_VARIFICATION = 'mandatory'\r\nACCOUNT_EMAIL_REQUIRED = True\r\n\u00a0\r\n# 5\r\nREST_USE_JWT = True\r\nJWT_AUTH = {\r\n    'JWT_VERIFY_EXPIRATION': False,\r\n}<\/pre>\n<p>\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u78ba\u8a8d\u306e\u70ba\u3001\u30e1\u30fc\u30eb\u914d\u4fe1\u3092\u884c\u3046\u306e\u3067\u3059\u304c\u3001\u8a2d\u5b9a\u304c\u624b\u9593\u306a\u306e\u3067\u3068\u308a\u3042\u3048\u305a\u958b\u767a\u4e2d\u306f\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3055\u305b\u308b\u8a2d\u5b9a\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'<\/pre>\n<h5>\u305d\u306e\u4ed6<\/h5>\n<p>\u8a00\u8a9e\u3068\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u3092\u65e5\u672c\u306b\u8a2d\u5b9a\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">LANGUAGE_CODE = 'ja'\r\nTIME_ZONE = 'Asia\/Tokyo'<\/pre>\n<p>\u4e00\u65e6\u3001\u3059\u3079\u3066\u306e\u30db\u30b9\u30c8\u3092\u3000\u6709\u52b9\u5316\u3057\u307e\u3059\u3002\uff08\u672c\u756a\u3067\u5229\u7528\u306e\u969b\u306f\u5236\u9650\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">ALLOWED_HOSTS = &#x5B;'*']<\/pre>\n<h4>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\uff08migrate\u5b9f\u884c\uff09<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ python manage.py migrate<\/pre>\n<p>\u554f\u984c\u304c\u306a\u3051\u308c\u3070\u3001\u30c6\u30fc\u30d6\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<h4>\u7ba1\u7406\u8005\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210<\/h4>\n<p>\u7ba1\u7406\u753b\u9762\u3092\u5229\u7528\u3067\u304d\u308b\u7ba1\u7406\u8005\u30e6\u30fc\u30b6\u30fc (\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc) \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u7ba1\u7406\u30b3\u30de\u30f3\u30c9\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ python manage.py createsuperuser<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ python manage.py createsuperuser\r\nUsername (leave blank to use 'user1'): admin\r\nEmail address: admin@webcyou.com\r\nPassword: # \u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\r\nPassword (again):\r\nThis password is too common. # \u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u5358\u7d14\u904e\u304e\u308b\u5834\u5408\u306f\u30a8\u30e9\u30fc\u767a\u751f\r\nPassword:\r\nPassword (again):\r\nSuperuser created successfully.<\/pre>\n<p>\u3053\u3053\u307e\u3067\u3001\u5b8c\u4e86\u3057\u305f\u3089\u30bd\u30fc\u30b7\u30e3\u30eb\u9023\u643a\u8a8d\u8a3c\u3092\u884c\u3046\u305f\u3081\u3001\u5404\u30b5\u30fc\u30d3\u30b9\u3067\u306eOAuth \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u767b\u9332\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h4>Google\u306e\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u8a2d\u5b9a<\/h4>\n<p>\u4eca\u56de\u306f\u300c<strong>Google<\/strong>\u300d\u3067\u30ed\u30b0\u30a4\u30f3\u3092\u884c\u3044\u307e\u3059\u306e\u3067\u3001\u30b5\u30fc\u30d3\u30b9\u306b\u3066\u00a0OAuth \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u767b\u9332\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u306e\u767b\u9332\u306e\u89e3\u8aac\u306f\u524d\u56de\u306e\u300c<a href=\"https:\/\/www.webcyou.com\/?p=10212\">Django django-allauth\u3067\u3001\u30b5\u30af\u30c3\u3068\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u5b9f\u88c5<\/a>\u300d\u3067\u3082\u8aac\u660e\u3057\u3066\u304a\u308a\u307e\u3059\u306e\u3067\u3001\u5272\u611b\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<\/p>\n<p>\u767b\u9332\u65b9\u6cd5\u304c\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001<a href=\"https:\/\/www.webcyou.com\/?p=10212\">\u3053\u3061\u3089<\/a>\u3092\u53c2\u7167\u3057\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h4>socialaccount\u7528\u306eviews\u4f5c\u6210<\/h4>\n<p>\u5fc5\u8981\u6700\u4f4e\u9650\u306e\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u7528\u306eviews\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>accounts\/views.py<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter\r\n\r\nfrom allauth.socialaccount.providers.oauth2.client import OAuth2Client\r\nfrom rest_auth.registration.views import SocialLoginView\r\nfrom rest_framework.authentication import SessionAuthentication, BasicAuthentication\r\n\r\nclass CsrfExemptSessionAuthentication(SessionAuthentication):\r\n    def enforce_csrf(self, request):\r\n        return\r\n\r\nclass GoogleLogin(SocialLoginView):\r\n    adapter_class = GoogleOAuth2Adapter\r\n    callback_url = 'http:\/\/127.0.0.1\/callback'\r\n    client_class = OAuth2Client\r\n    authentication_classes = (CsrfExemptSessionAuthentication, BasicAuthentication)<\/pre>\n<p>GoogleLogin class\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>adapter_class\u306b\u306f\u3001allauth.socialaccount.providers.google.views\u304b\u3089import\u3057\u305fGoogleOAuth2Adapter\u3092\u8a2d\u5b9a\u3002<\/p>\n<p>callback_url\u306f\u4efb\u610f\u306eURL\u3092\u8a2d\u5b9a\u3002<\/p>\n<p>client_class\u306b\u306f\u3001allauth.socialaccount.providers.oauth2.client\u304b\u3089import\u3057\u305fOAuth2Client\u3092\u8a2d\u5b9a\u3002<\/p>\n<p>\u305d\u306e\u307e\u307e\u3060\u3068\u3001API\u3067\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5bfe\u3057\u3066\u3001CSRF\u30c8\u30fc\u30af\u30f3\u304c\u306a\u3044\u70ba\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u305d\u308c\u3092\u56de\u907f\u3059\u308b\u305f\u3081CsrfExemptSessionAuthentication class\u3092\u4f5c\u6210\u3057\u3001\u30b9\u30eb\u30fc\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h4>url\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u8a2d\u5b9a<\/h4>\n<p>urls\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u9805\u76ee\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/webcyou-org\/simple-rest-login-server\/blob\/master\/config\/urls.py\" target=\"_blank\" rel=\"noopener\">\u8a72\u5f53\u30d5\u30a1\u30a4\u30eb<\/a><\/p>\n<p><strong>config\/urls.py<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">from django.conf.urls import include, url\r\nfrom accounts.views import GoogleLogin\r\n\r\npath('api-auth\/', include('rest_framework.urls')),\r\nurl(r'^rest-auth\/', include('rest_auth.urls')),\r\nurl(r'^rest-auth\/registration\/', include('rest_auth.registration.urls')),\r\nurl(r'^rest-auth\/google\/$', GoogleLogin.as_view(), name='google_login'),<\/pre>\n<p>api-auth\/\u306f\u3001\u30ed\u30b0\u30a4\u30f3\u5f8c\u306eAPI\u3068\u3057\u3066\u8a2d\u5b9a\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>rest-auth\/\u306f\u3001include(&#8216;rest_auth.urls&#8217;)\u3067\u3001django-rest-auth\u306eurl\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001registration\u306f\u5225\u306e\u6307\u5b9a\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u307d\u3044\uff08django-rest-auth\u306edemo\u3092\u307f\u308b\u3068\uff09\u306e\u3067\u6307\u5b9a\u3057\u3066\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30bd\u30fc\u30b7\u30e3\u30eb\u30a2\u30ab\u30a6\u30f3\u30c8\u6bce\u306b\u6307\u5b9a\u3082\u5fc5\u8981\u3068\u306a\u3063\u3066\u304d\u307e\u3059\u306e\u3067\u3001\u4f5c\u6210\u3057\u305fviews\u3092\u547c\u3073\u51fa\u3059\u69d8\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h4>API\u3067\u306e\u30ed\u30b0\u30a4\u30f3\u30c6\u30b9\u30c8<\/h4>\n<p>\u3053\u3053\u307e\u3067\u3001\u4fee\u6b63\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3089\u4e00\u901a\u308a\u5b9f\u884c\u3067\u304d\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001Postman\u306a\u3069\u3092\u4f7f\u3063\u3066API\u306e\u30c6\u30b9\u30c8\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u304b\u3089\u5b9f\u884c\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>django-rest-auth\u306eAPI\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/django-rest-auth.readthedocs.io\/en\/latest\/api_endpoints.html\" target=\"_blank\" rel=\"noopener\">https:\/\/django-rest-auth.readthedocs.io\/en\/latest\/api_endpoints.html<\/a><\/p>\n<h5>\u30e6\u30fc\u30b6\u30fc\u767b\u9332<\/h5>\n<p>API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8: \/rest-auth\/registration\/(POST)<\/p>\n<p>params:<\/p>\n<ul class=\"simple\">\n<li>username<\/li>\n<li>password1<\/li>\n<li>password2<\/li>\n<li>email<\/li>\n<\/ul>\n<p>\u3053\u3053\u3067\u306f\u3001username\u3092\u5fc5\u8981\u3068\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001setting\u3067\u5fc5\u9808\u9805\u76ee\u3068\u3057\u3066\u306f\u5916\u3057\u305f\u306e\u3067\u300cemail\u300d\u300cpassword1\u300d\u300cpassword2\u300d\u306e\u9805\u76ee\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u307e\u3059\u3002<\/p>\n<p>localhost:8000\u30dd\u30fc\u30c8\u3067\u8d77\u52d5\u3057\u3066\u3044\u308b\u306e\u3067\u3001URL\u306f\u4ee5\u4e0b\u306e\u69d8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u69d8\u306b\u9001\u4fe1\u3059\u308b\u3068\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u3067token\u306evalue\u3067JWT\u30c8\u30fc\u30af\u30f3\u304c\u8fd4\u5374\u3055\u308c\u308b\u306e\u3068\u3001user\u60c5\u5831\u304c\u8fd4\u5374\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10328\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/41ddeb0eb66ddf793bb690f4adf3926f.png\" alt=\"\" width=\"465\" height=\"515\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/41ddeb0eb66ddf793bb690f4adf3926f.png 584w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/41ddeb0eb66ddf793bb690f4adf3926f-271x300.png 271w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/p>\n<p>django admin\u3067\u3001\uff08http:\/\/localhost:8000\/admin\uff09<\/p>\n<p>\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u3092\u78ba\u8a8d\u3059\u308b\u3068\u65b0\u898f\u3067\u30e6\u30fc\u30b6\u30fc\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10333\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/ffbc8aba71f8462eb6b9e2ab7c2e8fe1.png\" alt=\"\" width=\"377\" height=\"126\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/ffbc8aba71f8462eb6b9e2ab7c2e8fe1.png 482w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/ffbc8aba71f8462eb6b9e2ab7c2e8fe1-300x100.png 300w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/p>\n<p>\u307e\u305f\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001\u9001\u4fe1\u3059\u308b\u30e1\u30fc\u30eb\u306e\u5185\u5bb9\u304c\u8868\u793a\u3055\u308c\u308b\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30e1\u30fc\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u69d8\u306bURL\u304c\u767a\u884c\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>http:\/\/localhost:8000\/rest-auth\/registration\/account-confirm-email\/{activation-key}\/<\/p>\n<p>\u767a\u884c\u3055\u308c\u305factivation-key\u3092\u4f7f\u3044\u3001\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30c8\uff08email\u306e\u78ba\u8a8d\uff09\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<h5>\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30c8<\/h5>\n<p>API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8: \/rest-auth\/registration\/verify-email\/ (POST)<\/p>\n<p>params:<\/p>\n<ul class=\"simple\">\n<li>key<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10341\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/3cd253e8403ebb98a9e4e6c475bc69cf.png\" alt=\"\" width=\"377\" height=\"365\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/3cd253e8403ebb98a9e4e6c475bc69cf.png 445w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/3cd253e8403ebb98a9e4e6c475bc69cf-300x291.png 300w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/p>\n<p>email\u306e\u5b58\u5728\u78ba\u8a8d\u304c\u3067\u304d\u3001\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u73fe\u72b6\u3001\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30c8\u305b\u305a\u306b\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u307e\u3059\u304c\u3001\u672c\u756a\u904b\u7528\u306a\u3069\u306e\u969b\u306f\u3001\u8a2d\u5b9a\u3092\u884c\u3063\u305f\u307b\u3046\u304c\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h5>\u30ed\u30b0\u30a4\u30f3<\/h5>\n<p>\u305d\u308c\u3067\u306f\u3001\u767b\u9332\u3055\u308c\u305f\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u30ed\u30b0\u30a4\u30f3\u3092\u8a66\u307f\u3066\u898b\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8: \/rest-auth\/login\/ (POST)<\/p>\n<p>params:<\/p>\n<ul class=\"simple\">\n<li>username<\/li>\n<li>email<\/li>\n<li>password<\/li>\n<\/ul>\n<p>Returns Token key<\/p>\n<p>\u3053\u3053\u3067\u3082\u3001username\u304c\u5fc5\u8981\u9805\u76ee\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u304c\u3001email\u3068password\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u304b\u3063\u305f\u306e\u3067\u3001setting.py\u3067username\u3092\u5916\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u300cemail\u300d\u300cpassword\u300d\u3092\u9001\u4fe1\u3057\u30ed\u30b0\u30a4\u30f3\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10329\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/b4194d0516324b16da7f55a37bc50e85.png\" alt=\"\" width=\"436\" height=\"491\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/b4194d0516324b16da7f55a37bc50e85.png 561w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/b4194d0516324b16da7f55a37bc50e85-266x300.png 266w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/p>\n<p>\u30ed\u30b0\u30a2\u30a6\u30c8\u306b\u95a2\u3057\u3066\u306f\u3001SPA\u306b\u3088\u308bJWT\u8a8d\u8a3c\u306e\u5f62\u3068\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u30ed\u30b0\u30a4\u30f3\u72b6\u614b\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u4fdd\u6301\u3057\u306a\u3044\uff08\u53c2\u7167\u3057\u306a\u3044\uff09\u30d5\u30ed\u30fc\u3068\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u3067\u306e\u30ed\u30b0\u30a2\u30a6\u30c8\u3068\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u7279\u5225\u9001\u4fe1\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8: \/rest-auth\/logout\/ (POST)<\/p>\n<h5>\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u53d6\u5f97<\/h5>\n<p>UserInfo\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8: \/rest-auth\/user\/ (GET, PUT, PATCH)<\/p>\n<p>params:<\/p>\n<ul class=\"simple\">\n<li>username<\/li>\n<li>first_name<\/li>\n<li>last_name<\/li>\n<\/ul>\n<p>Returns pk, username, email, first_name, last_name<\/p>\n<p>\u3053\u3061\u3089\u306f\u3001\u30ea\u30af\u30a8\u30b9\u30c8body\u3067\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u5fc5\u8981\u3068\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u30fc\u306eAuthorization\u306bJWT\u30c8\u30fc\u30af\u30f3\u3092\u4ed8\u4e0e\u3057\u3066\u9001\u4fe1\u3059\u308b\u3068\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u304c\u8fd4\u5374\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>django-rest-auth\u3067\u306eAuthorization\u306eValue\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u300cJWT JWT-Token\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u300cJWT\u300d\u306e\u5f8c\u306b\u3001\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u3002\u305d\u306e\u5f8c\u306b\u3001\u30ed\u30b0\u30a4\u30f3\u6210\u529f\u5f8c\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u306b\u542b\u307e\u308c\u308btoken\u306e JWT\u30c8\u30fc\u30af\u30f3\u3092\u4ed8\u4e0e\u3057\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u5f62\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10337\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/8cf390d03195ed66aebebe4115e2f355.png\" alt=\"\" width=\"522\" height=\"79\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/8cf390d03195ed66aebebe4115e2f355.png 522w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/8cf390d03195ed66aebebe4115e2f355-300x45.png 300w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/p>\n<p>\u30ed\u30b0\u30a4\u30f3\u5f8c\u306eJWT\u30c8\u30fc\u30af\u30f3\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u30fc\u306eAuthorization\u306b\u4ed8\u4e0e\u3057\u3066\u9001\u4fe1\u3059\u308b\u3068\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u304c\u8fd4\u5374\u3055\u308c\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10338\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/715497c11bd2f4b1ec344d938475a73a.png\" alt=\"\" width=\"280\" height=\"155\" \/><\/p>\n<p>\u30ed\u30b0\u30a4\u30f3\u5f8c\u306f\u3001\u3053\u306eJWT\u30c8\u30fc\u30af\u30f3\u3092\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u3067\u4fdd\u6301\u3057\u30bb\u30ad\u30e5\u30a2\u306a\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u969b\u306f\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u30fc\u306b\u4ed8\u4e0e\u3057\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u3053\u3068\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>JWT\u30c8\u30fc\u30af\u30f3\u306e\u671f\u9650\u304c\u5207\u308c\u305f\u5834\u5408\u3001\u30ea\u30e1\u30f3\u30d0\u30fc\u30c8\u30fc\u30af\u30f3\u3092\u9001\u4fe1\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u958b\u767a\u74b0\u5883\u3068\u3044\u3046\u4e8b\u3067\u3001\u7701\u7565\u3057\u671f\u9650\u306a\u3057\u3068\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u4ed6\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u30ea\u30bb\u30c3\u30c8\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u3061\u3089\u3082\u4eca\u56de\u5272\u611b\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002\uff08\u307e\u305f\u306e\u6a5f\u4f1a\u306b\u3067\u3082\uff09<\/p>\n<h4>\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u306e\u30c6\u30b9\u30c8<\/h4>\n<p>\u3068\u3001\u6700\u4f4e\u9650\u30e1\u30fc\u30eb\u3067\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u767b\u9332\u3001\u30ed\u30b0\u30a4\u30f3\u306a\u3069\u306e\u78ba\u8a8d\u304c\u3067\u304d\u307e\u3057\u305f\u306e\u3067\u3001\u7d9a\u3044\u3066\u30bd\u30fc\u30b7\u30e3\u30eb\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u306e\u767b\u9332\u3001\u30ed\u30b0\u30a4\u30f3\u3092\u8a66\u3057\u3066\u884c\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30bd\u30fc\u30b7\u30e3\u30eb\u30a2\u30ab\u30a6\u30f3\u30c8\u306eAPI\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8: \/rest-auth\/google\/ (POST)<\/p>\n<p>params:<\/p>\n<ul class=\"simple\">\n<li>access_token<\/li>\n<li>code<\/li>\n<\/ul>\n<p>facebook\u3082\u300c\/rest-auth\/facebook\/ (POST)\u300d\u3068\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3060\u3051\u7570\u306a\u308a\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u300caccess_token, code\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u3001<a href=\"https:\/\/www.webcyou.com\/?p=10264\">\u524d\u56de<\/a>\u306e\u300c<strong>\u30cf\u30a4\u30d6\u30ea\u30c3\u30c9\u30d5\u30ed\u30fc<\/strong>\u300d\u3092\u601d\u3044\u51fa\u3057\u3066\u6b32\u3057\u3044\u306e\u3067\u3059\u304c\u3001response_type\u306b<strong>\u300ccode token\u300d<\/strong>\u3092\u8a2d\u5b9a\u3057\u300c<strong>\u30cf\u30a4\u30d6\u30ea\u30c3\u30c9\u30d5\u30ed\u30fc<\/strong>\u300d\u3092\u884c\u3046\u4e88\u5b9a\u3060\u3063\u305f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u3092\u958b\u59cb\u3059\u308b\u969b\u306b\u3001response_type\u306b<strong>\u300ccode token\u300d<\/strong>\u3092\u8a2d\u5b9a\u3057\u30ec\u30b9\u30dd\u30f3\u30b9\u306b\u3001code\u3068access_token\u3092\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/?p=10259\">\u524d\u56de\u7d39\u4ecb<\/a>\u3055\u305b\u3066\u9802\u3044\u305f\u300cOAuth Social Login Checker\u300d\u306a\u3069\u3092\u5229\u7528\u3059\u308c\u3070\u3001\u5bb9\u6613\u306b\u53d6\u5f97\u3059\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/webcyou-org\/oauth-social-login-checker\" data-pjax=\"#js-repo-pjax-container\">oauth-social-login-checker<\/a><\/p>\n<p>\u4e0a\u8a18\u306e\u30c4\u30fc\u30eb\u306a\u3069\u3092\u5229\u7528\u3057\u3001\u300ccode\u300d\u3068\u300caccess_token\u300d\u3092\u53d6\u5f97\u3057\u3001\u4ee5\u4e0b\u306e\u69d8\u306b\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u7528\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306b\u9001\u4fe1\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10335\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt3-1.png\" alt=\"\" width=\"493\" height=\"584\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt3-1.png 582w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt3-1-253x300.png 253w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u30e1\u30fc\u30eb\u3067\u306e\u767b\u9332\u3001\u30ed\u30b0\u30a4\u30f3\u540c\u69d8\u306b\u30ec\u30b9\u30dd\u30f3\u30b9\u306b\u300ctoken\u300d\u3068\u300cuser\u300d\u304c\u8fd4\u5374\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30a2\u30ab\u30a6\u30f3\u30c8\u304c\u767b\u9332\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u65b0\u898f\u4f5c\u6210\u3002\u65e2\u306b\u3042\u308b\u5834\u5408\u306f\u30ed\u30b0\u30a4\u30f3\u3068\u3044\u3046\u5f62\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\uff08\u30ec\u30b9\u30dd\u30f3\u30b9\u306f\u3069\u3061\u3089\u3082\u4e0a\u8a18\u306e\u5f62\u3068\u306a\u308b\u3002\uff09<\/p>\n<p>\u30e1\u30fc\u30eb\u3067\u306e\u767b\u9332\u540c\u69d8\u306bUserInfo\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u53e9\u3044\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8: \/rest-auth\/user\/ (GET, PUT, PATCH)<\/p>\n<ul class=\"simple\">\n<li>username<\/li>\n<li>first_name<\/li>\n<li>last_name<\/li>\n<\/ul>\n<p>Returns pk, username, email, first_name, last_name<\/p>\n<p>\u3059\u308b\u3068\u3001\u30e1\u30fc\u30eb\u3067\u306e\u767b\u9332\u540c\u69d8\u306b\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u306e\u53d6\u5f97\u304c\u884c\u3048\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u305f\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u8a33\u3067\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067\u306e\u767b\u9332\u3001\u30ed\u30b0\u30a4\u30f3\u3001\u30bd\u30fc\u30b7\u30e3\u30eb\u30ed\u30b0\u30a4\u30f3\u304cREST API\u306eJWT\u30c8\u30fc\u30af\u30f3\u3067\u884c\u3048\u305f\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u306e\u3067\u3001\u6b21\u56de\u306f\u30d5\u30ed\u30f3\u30c8\u5074\u3092\u5b9f\u88c5\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u7d9a\u304d\u306f\u6b21\u56de\u306b\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u3041\u3002<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/?p=10307\">Django django-rest-auth + Nuxt.js auth-module \u3067\u4f5c\u308b SPA JWT OAuth \u30ed\u30b0\u30a4\u30f3\u30b7\u30b9\u30c6\u30e0 \u305d\u306e\uff13<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt1b.png\" alt=\"\" width=\"536\" height=\"220\" class=\"alignnone size-full wp-image-10352\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt1b.png 536w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2020\/06\/django_nuxt1b-300x123.png 300w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><\/p>\n<p><strong>GitHub<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/webcyou-org\/simple-rest-login-server\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/webcyou-org\/simple-rest-login-server<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3082\u3067\u3059\u3002 \u524d\u56de\u306e\u300cDjango django-rest-auth + Nuxt.js auth-module \u3067\u4f5c\u308b SPA JWT OAuth \u30ed\u30b0\u30a4\u30f3\u30b7\u30b9\u30c6\u30e0 \u305d\u306e\uff11\u300d\u306e\u7d9a\u304d\u3068\u306a\u308a\u307e\u3059\u3002 Django\u306eNuxt.j [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[257],"tags":[168,176,40,166,37,47,180,150,44,45,39,55,178,138,78,114,118],"class_list":{"0":"post-10266","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-python","7":"tag-html","8":"tag-html5","9":"tag-ios-sdk","10":"tag-iphone","11":"tag-iphone-","12":"tag-javascript-2","13":"tag-mysql","14":"tag-vagrant","15":"tag-web","17":"tag-39","18":"tag-55","19":"tag-178","20":"tag-138","21":"tag-78","22":"tag-114","23":"tag-118"},"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/10266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10266"}],"version-history":[{"count":34,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/10266\/revisions"}],"predecessor-version":[{"id":10377,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/10266\/revisions\/10377"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}