fix token

This commit is contained in:
2025-10-24 21:33:02 -03:00
parent c4509f5072
commit 2fba9ba059
2 changed files with 11 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ class User:
name: str name: str
email: str email: str
email_verified: bool = False email_verified: bool = False
scope: list[str] | None = None scope: str | None = None
def get_user_id(self): def get_user_id(self):
return self.id return self.id

View File

@@ -76,7 +76,7 @@ class OpenIDCode(OpenIDCode_):
).filter(scope) ).filter(scope)
if user.scope: if user.scope:
user_info['scope'] = ' '.join(user.scope) user_info['scope'] = user.scope
return user_info return user_info
@@ -175,10 +175,17 @@ class AuthorizationCodeGrant(grants.AuthorizationCodeGrant):
user = dyn.collection.get_items( user = dyn.collection.get_items(
TransactKey(authorization_code.user_id) TransactKey(authorization_code.user_id)
+ SortKey('0') + SortKey('0')
+ SortKey('SCOPE', path_spec='scope', rename_key='scope'), + SortKey(
sk='SCOPE',
path_spec='scope',
rename_key='scope',
),
) )
return User(**pick(('id', 'name', 'email', 'email_verified', 'scope'), user)) return User(
**pick(('id', 'name', 'email', 'email_verified'), user),
scope=' '.join(user['scope']) if 'scope' in user else None,
)
class TokenExchangeGrant(grants.BaseGrant): class TokenExchangeGrant(grants.BaseGrant):