Skip to content

Conversation

@jonatascastro12
Copy link
Contributor

@jonatascastro12 jonatascastro12 commented Nov 5, 2024

Description

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.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@jonatascastro12 jonatascastro12 requested a review from a team as a code owner November 5, 2024 22:10
@linear
Copy link

linear bot commented Nov 5, 2024

@jonatascastro12 jonatascastro12 changed the title Add oauth_tokens to AuthenticationResponse Add oauth_tokens to AuthenticationResponse Nov 5, 2024
@jonatascastro12 jonatascastro12 force-pushed the feature/auth-3820-add-oauth_credentials-to-sdks-2 branch from 10879ec to b95dc7b Compare November 5, 2024 22:12
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.
@jonatascastro12 jonatascastro12 force-pushed the feature/auth-3820-add-oauth_credentials-to-sdks-2 branch from b95dc7b to 73bdedd Compare November 5, 2024 22:13
Copy link
Contributor

@mattgd mattgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some small feedback.

access_token: str
refresh_token: str
expires_at: int
scopes: List[str]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For fields where we don't necessarily need mutability, we've been using the Sequence type instead of List. Example here.

impersonator: Optional[Impersonator] = None
organization_id: Optional[str] = None
user: User
oauth_tokens: Optional[OAuthTokens] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will OAuth credentials exist for all authentication methods or just authenticate with code?

Copy link
Contributor Author

@jonatascastro12 jonatascastro12 Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for authenticate_with_code - so I guess we should split this type apart?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattgd I'm wondering if I change the response, would it be considered a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I found that I had the new field to the AuthKitAuthenticationResponse

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about that type, nice!

@jonatascastro12 jonatascastro12 changed the title Add oauth_tokens to AuthenticationResponse Add oauth_tokens to AuthkitAuthenticationResponse Nov 6, 2024
@jonatascastro12 jonatascastro12 merged commit 158b013 into main Nov 6, 2024
5 checks passed
@jonatascastro12 jonatascastro12 deleted the feature/auth-3820-add-oauth_credentials-to-sdks-2 branch November 6, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants