mirror of
https://github.com/suitenumerique/docs.git
synced 2026-05-10 00:52:11 +02:00
Used https://github.com/openfun/joanie as boilerplate, ran a few transformations with ChapGPT and adapted models and endpoints to fit to my current vision of the project.
19 lines
423 B
Python
19 lines
423 B
Python
"""
|
|
Utils that can be useful throughout the People core app
|
|
"""
|
|
from django.conf import settings
|
|
from django.utils import timezone
|
|
|
|
import jwt
|
|
from rest_framework_simplejwt.tokens import RefreshToken
|
|
|
|
|
|
def get_tokens_for_user(user):
|
|
"""Get JWT tokens for user authentication."""
|
|
refresh = RefreshToken.for_user(user)
|
|
|
|
return {
|
|
"refresh": str(refresh),
|
|
"access": str(refresh.access_token),
|
|
}
|