Skip to content

Commit b95dc7b

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 b95dc7b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

workos/types/user_management/authentication_response.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Literal, Optional, TypeVar
22
from workos.types.user_management.impersonator import Impersonator
3+
from workos.types.user_management.oauth_tokens import OAuthTokens
34
from workos.types.user_management.user import User
45
from workos.types.workos_model import WorkOSModel
56

@@ -28,6 +29,7 @@ class AuthenticationResponse(_AuthenticationResponseBase):
2829
impersonator: Optional[Impersonator] = None
2930
organization_id: Optional[str] = None
3031
user: User
32+
oauth_tokens: Optional[OAuthTokens] = NonExtClassBuilder
3133

3234

3335
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)