Skip to content

Commit e08d306

Browse files
committed
add token expiration time fields to Application model
1 parent c2f379d commit e08d306

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

oauth2_provider/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ class AbstractApplication(models.Model):
8383
created = models.DateTimeField(auto_now_add=True)
8484
updated = models.DateTimeField(auto_now=True)
8585

86+
access_token_expire_seconds = models.IntegerField(
87+
default=oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS
88+
)
89+
refresh_token_expire_seconds = models.IntegerField(
90+
default=oauth2_settings.REFRESH_TOKEN_EXPIRE_SECONDS
91+
)
8692
class Meta:
8793
abstract = True
8894

oauth2_provider/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"READ_SCOPE": "read",
4545
"WRITE_SCOPE": "write",
4646
"AUTHORIZATION_CODE_EXPIRE_SECONDS": 60,
47-
"ACCESS_TOKEN_EXPIRE_SECONDS": 36000,
48-
"REFRESH_TOKEN_EXPIRE_SECONDS": None,
47+
"ACCESS_TOKEN_EXPIRE_SECONDS": 36000, # 10 hours in seconds
48+
"REFRESH_TOKEN_EXPIRE_SECONDS": 31556952, # 1 year in seconds
4949
"REFRESH_TOKEN_GRACE_PERIOD_SECONDS": 0,
5050
"ROTATE_REFRESH_TOKEN": True,
5151
"ERROR_RESPONSE_WITH_SCOPES": False,

0 commit comments

Comments
 (0)