Skip to content

Commit 10879ec

Browse files
Add OAuthTokens model
Created a new OAuthTokens model to represent OAuth credentials, including provider, access token, refresh token, expiration, and scopes. Integrated this new model into the AuthenticationResponse class, adding an optional field for OAuth tokens.
1 parent 0848cd0 commit 10879ec

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

workos/types/user_management/authentication_response.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
from typing import Literal, Optional, TypeVar
2+
3+
from mypyc.irbuild.classdef import NonExtClassBuilder
4+
25
from workos.types.user_management.impersonator import Impersonator
6+
from workos.types.user_management.oauth_tokens import OAuthTokens
37
from workos.types.user_management.user import User
48
from workos.types.workos_model import WorkOSModel
59

@@ -28,6 +32,7 @@ class AuthenticationResponse(_AuthenticationResponseBase):
2832
impersonator: Optional[Impersonator] = None
2933
organization_id: Optional[str] = None
3034
user: User
35+
oauth_tokens: Optional[OAuthTokens] = NonExtClassBuilder
3136

3237

3338
class AuthKitAuthenticationResponse(AuthenticationResponse):
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Literal, List
2+
from workos.types.workos_model import WorkOSModel
3+
4+
OAuthTokensProvidersType = Literal[
5+
"AppleOauth",
6+
"GitHubOauth",
7+
"GoogleOauth",
8+
"MicrosoftOauth",
9+
]
10+
11+
12+
class OAuthTokens(WorkOSModel):
13+
"""Representation of a WorkOS Dashboard member impersonating a user"""
14+
15+
provider: OAuthTokensProvidersType
16+
access_token: str
17+
refresh_token: str
18+
expires_at: int
19+
scopes: List[str]

0 commit comments

Comments
 (0)