Skip to main content

JSON Web Token based authentication for Django REST framework,this use to WeChat applet (小程序使用jwt)

Project description

drf-jwt-wechat 是在jwt,跟rest_framework_jwt基础上进行修改过的,用于微信小程序登录, 前端只需post方法传code即可进行jwt登录验证

Usage

在django项目settings中添加修改APP_ID=xxxx,APP_SECRET=xxxxx,以及跟rest_framework_jwt包同样配置如下

REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
    'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
    'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
    'rest_framework.authentication.SessionAuthentication',
    'rest_framework.authentication.BasicAuthentication',
),

在url中引用

from drf_jwt_wechat.views import obtain_jwt_token
#...

urlpatterns = [
    '',
    # ...

    url(r'^api-token-auth/', obtain_jwt_token),
]

后续

因为水平有限,目前只有登录,没有Refresh Token,以及Verify Token,不影响rest_framework_jwt的api使用。 任何问题请联系 https://github.com/liazylee/ 源码详解 https://blog.csdn.net/liazylee/article/details/90717939

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drf_jwt_wechat-1.11.9.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

drf_jwt_wechat-1.11.9-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file drf_jwt_wechat-1.11.9.tar.gz.

File metadata

  • Download URL: drf_jwt_wechat-1.11.9.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for drf_jwt_wechat-1.11.9.tar.gz
Algorithm Hash digest
SHA256 dda2c2f0738890757d95f2baf1110da57ac9dc62172f96cf40345449f0e19f7f
MD5 ac5ef9c08f1f77005192610eb28b9d70
BLAKE2b-256 99ede71d68fcddbd3a1de9a4a235c97abacf1d5e0eadd95beada5e2aed4b25a6

See more details on using hashes here.

File details

Details for the file drf_jwt_wechat-1.11.9-py3-none-any.whl.

File metadata

  • Download URL: drf_jwt_wechat-1.11.9-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for drf_jwt_wechat-1.11.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b185882d192d994b99ff42fea7fc73309296d7400b27604896c35cb27eda82e2
MD5 c4a098bf42c39251173f1b9051c57b54
BLAKE2b-256 b223b5dbd26744c10a066fdeefb75420a00200ad275e2309045982d9cc5d3cbb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page