Closed behconsci closed 2 years ago
Okay, got it working:
from graphql_jwt.utils import jwt_payload, jwt_encode, set_cookie
payload = jwt_payload(user=request.user)
jwt_token = jwt_encode(payload=payload)
expires = datetime.utcnow() + settings.GRAPHQL_JWT.get('JWT_EXPIRATION_DELTA')
# set JWT cookie for GraphQL
set_cookie(
response,
settings.GRAPHQL_JWT.get('JWT_COOKIE_NAME'),
jwt_token,
expires=expires,
)
I am setting up SSO Login which works with Okta and my frontend is NextJs. After SSO Login, I want to redirect to frontend App with JWT Cookie already set. I can not call
setup_jwt_cookie
decorator because it is meant for GraphQL View.I could not find anything in source code, is there some hack for this usecase?