Skip to content

Commit 158b013

Browse files
Add oauth_tokens to AuthkitAuthenticationResponse (#378)
* 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. * Refactor types and rearrange optional attribute
1 parent 0848cd0 commit 158b013

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-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

@@ -34,6 +35,7 @@ class AuthKitAuthenticationResponse(AuthenticationResponse):
3435
"""Representation of a WorkOS User and Organization ID response."""
3536

3637
impersonator: Optional[Impersonator] = None
38+
oauth_tokens: Optional[OAuthTokens] = None
3739

3840

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

0 commit comments

Comments
 (0)