File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
organization_access_token Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 32
32
log : Logger = structlog .get_logger ()
33
33
34
34
TOKEN_PREFIX = "polar_oat_"
35
+ TOKEN_PREFIX_SANDBOX = "polar_sandbox_oat_"
35
36
36
37
37
38
class OrganizationAccessTokenService :
@@ -105,8 +106,14 @@ async def create(
105
106
organization = await get_payload_organization (
106
107
session , auth_subject , create_schema
107
108
)
109
+
110
+ if settings .is_sandbox ():
111
+ token_prefix = TOKEN_PREFIX_SANDBOX
112
+ else :
113
+ token_prefix = TOKEN_PREFIX
114
+
108
115
token , token_hash = generate_token_hash_pair (
109
- secret = settings .SECRET , prefix = TOKEN_PREFIX
116
+ secret = settings .SECRET , prefix = token_prefix
110
117
)
111
118
organization_access_token = OrganizationAccessToken (
112
119
** create_schema .model_dump (
Original file line number Diff line number Diff line change 18
18
19
19
log : Logger = structlog .get_logger ()
20
20
21
- TOKEN_PREFIX = "polar_pat_"
21
+ # We no longer allow the creation of Personal Access Tokens (PATs), so the
22
+ # below prefix is now unused in active code. However, customers may still
23
+ # actively be using PATs for API authentication and we continue to support
24
+ # that.
25
+ # The prefix is listed here for later reference.
26
+ #
27
+ # TOKEN_PREFIX = "polar_pat_"
22
28
23
29
24
30
class PersonalAccessTokenService (ResourceServiceReader [PersonalAccessToken ]):
You can’t perform that action at this time.
0 commit comments