Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rest_framework_simplejwt/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ class RefreshToken(BlacklistMixin["RefreshToken"], Token):
# we wouldn't want to copy either one.
api_settings.JTI_CLAIM,
"jti",
"iat",
)
access_token_class = AccessToken

Expand Down
10 changes: 7 additions & 3 deletions tests/test_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt

from rest_framework_simplejwt.exceptions import (
Expand Down Expand Up @@ -434,10 +435,13 @@ def test_init(self):

def test_access_token(self):
# Should create an access token from a refresh token
refresh = RefreshToken()
refresh["test_claim"] = "arst"
with freeze_time("2025-01-01"):
refresh = RefreshToken()
refresh["test_claim"] = "arst"

access = refresh.access_token
with freeze_time("2025-01-02"):
# Ensure iat is different
access = refresh.access_token

self.assertIsInstance(access, AccessToken)
Comment on lines +442 to 446
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

self.assertEqual(access[api_settings.TOKEN_TYPE_CLAIM], "access")
Expand Down