Skip to content

Commit f4d773e

Browse files
Mark access token as optional for OAuth responses (#199)
1 parent 1ea6333 commit f4d773e

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

stytch/b2b/api/sessions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def migrate(
424424
session_duration_minutes: Optional[int] = None,
425425
session_custom_claims: Optional[Dict[str, Any]] = None,
426426
) -> MigrateResponse:
427-
"""Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with a Member in your Organization and create a Stytch Session.
427+
"""Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with an existing Member in your Organization and create a Stytch Session. You will need to create the member before using this endpoint.
428428
429429
Fields:
430430
- session_token: The authorization token Stytch will pass in to the external userinfo endpoint.
@@ -465,7 +465,7 @@ async def migrate_async(
465465
session_duration_minutes: Optional[int] = None,
466466
session_custom_claims: Optional[Dict[str, Any]] = None,
467467
) -> MigrateResponse:
468-
"""Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with a Member in your Organization and create a Stytch Session.
468+
"""Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with an existing Member in your Organization and create a Stytch Session. You will need to create the member before using this endpoint.
469469
470470
Fields:
471471
- session_token: The authorization token Stytch will pass in to the external userinfo endpoint.

stytch/b2b/models/oauth.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ class AuthenticateRequestLocale(str, enum.Enum):
2727
class ProviderValues(pydantic.BaseModel):
2828
"""
2929
Fields:
30-
- access_token: The `access_token` that you may use to access the User's data in the provider's API.
3130
- scopes: The OAuth scopes included for a given provider. See each provider's section above to see which scopes are included by default and how to add custom scopes.
31+
- access_token: The `access_token` that you may use to access the User's data in the provider's API.
3232
- refresh_token: The `refresh_token` that you may use to obtain a new `access_token` for the User within the provider's API.
3333
- expires_at: (no documentation yet)
3434
- id_token: The `id_token` returned by the OAuth provider. ID Tokens are JWTs that contain structured information about a user. The exact content of each ID Token varies from provider to provider. ID Tokens are returned from OAuth providers that conform to the [OpenID Connect](https://openid.net/foundation/) specification, which is based on OAuth.
3535
""" # noqa
3636

37-
access_token: str
3837
scopes: List[str]
38+
access_token: Optional[str] = None
3939
refresh_token: Optional[str] = None
4040
expires_at: Optional[datetime.datetime] = None
4141
id_token: Optional[str] = None

stytch/b2b/models/organizations_members_oauth_providers.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ class GoogleResponse(ResponseBase):
1616
Fields:
1717
- provider_type: Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Microsoft, GitHub etc.
1818
- provider_subject: The unique identifier for the User within a given OAuth provider. Also commonly called the `sub` or "Subject field" in OAuth protocols.
19-
- access_token: The `access_token` that you may use to access the User's data in the provider's API.
20-
- access_token_expires_in: The number of seconds until the access token expires.
2119
- id_token: The `id_token` returned by the OAuth provider. ID Tokens are JWTs that contain structured information about a user. The exact content of each ID Token varies from provider to provider. ID Tokens are returned from OAuth providers that conform to the [OpenID Connect](https://openid.net/foundation/) specification, which is based on OAuth.
2220
- scopes: The OAuth scopes included for a given provider. See each provider's section above to see which scopes are included by default and how to add custom scopes.
21+
- access_token: The `access_token` that you may use to access the User's data in the provider's API.
22+
- access_token_expires_in: The number of seconds until the access token expires.
2323
- refresh_token: The `refresh_token` that you may use to obtain a new `access_token` for the User within the provider's API.
2424
""" # noqa
2525

2626
provider_type: str
2727
provider_subject: str
28-
access_token: str
29-
access_token_expires_in: int
3028
id_token: str
3129
scopes: List[str]
30+
access_token: Optional[str] = None
31+
access_token_expires_in: Optional[int] = None
3232
refresh_token: Optional[str] = None
3333

3434

stytch/b2b/models/scim.py

+2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ class SCIMConnection(pydantic.BaseModel):
2727
base_url: str
2828
bearer_token_last_four: str
2929
scim_group_implicit_role_assignments: List[SCIMGroupImplicitRoleAssignments]
30+
next_bearer_token_last_four: str
3031
bearer_token_expires_at: Optional[datetime.datetime] = None
32+
next_bearer_token_expires_at: Optional[datetime.datetime] = None
3133

3234

3335
class SCIMConnectionWithNextToken(pydantic.BaseModel):

stytch/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "9.2.0"
1+
__version__ = "9.3.0"

0 commit comments

Comments
 (0)