flavors / django-graphql-jwt

JSON Web Token (JWT) authentication for Graphene Django
https://django-graphql-jwt.domake.io
MIT License
820 stars 171 forks source link

Add @jwt_refresh_cookie decorator #287

Open mongkok opened 3 years ago

mongkok commented 3 years ago

ref #217 #230 #276

@jwt_cookie

 from django.urls import path

from graphene_django.views import GraphQLView
from graphql_jwt.decorators import jwt_cookie

urlpatterns = [
    path("graphql/", jwt_cookie(GraphQLView.as_view())),
]
GRAPHQL_JWT = {
    "JWT_VERIFY_EXPIRATION": True,
    "JWT_LONG_RUNNING_REFRESH_TOKEN": True,
    "JWT_HIDE_TOKEN_FIELDS": True,
}

@jwt_refresh_cookie 🆕

 from django.urls import path

from graphene_django.views import GraphQLView
from graphql_jwt.decorators import jwt_refresh_cookie

urlpatterns = [
    path("graphql/", jwt_refresh_cookie(GraphQLView.as_view())),
]
GRAPHQL_JWT = {
    "JWT_VERIFY_EXPIRATION": True,
    "JWT_LONG_RUNNING_REFRESH_TOKEN": True,
    "JWT_HIDE_REFRESH_TOKEN_FIELD": True,
}
codecov-commenter commented 3 years ago

Codecov Report

Merging #287 (0776daf) into main (704f24e) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #287   +/-   ##
=======================================
  Coverage   99.84%   99.84%           
=======================================
  Files          47       47           
  Lines        1321     1321           
=======================================
  Hits         1319     1319           
  Misses          2        2           
Impacted Files Coverage Δ
graphql_jwt/decorators.py 100.00% <ø> (ø)
graphql_jwt/settings.py 100.00% <ø> (ø)
graphql_jwt/mixins.py 100.00% <100.00%> (ø)
graphql_jwt/refresh_token/mixins.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 704f24e...0776daf. Read the comment docs.