-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add User Impersonation Authenticate Method (#232)
Co-authored-by: Stytch Codegen Bot <[email protected]>
- Loading branch information
Showing
7 changed files
with
89 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# !!! | ||
# WARNING: This file is autogenerated | ||
# Only modify code within MANUAL() sections | ||
# or your changes may be overwritten later! | ||
# !!! | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Any, Dict | ||
|
||
from stytch.b2b.models.impersonation import AuthenticateResponse | ||
from stytch.core.api_base import ApiBase | ||
from stytch.core.http.client import AsyncClient, SyncClient | ||
|
||
|
||
class Impersonation: | ||
def __init__( | ||
self, api_base: ApiBase, sync_client: SyncClient, async_client: AsyncClient | ||
) -> None: | ||
self.api_base = api_base | ||
self.sync_client = sync_client | ||
self.async_client = async_client | ||
|
||
def authenticate( | ||
self, | ||
token: str, | ||
) -> AuthenticateResponse: | ||
headers: Dict[str, str] = {} | ||
data: Dict[str, Any] = { | ||
"token": token, | ||
} | ||
|
||
url = self.api_base.url_for("/v1/b2b/impersonation/authenticate", data) | ||
res = self.sync_client.post(url, data, headers) | ||
return AuthenticateResponse.from_json(res.response.status_code, res.json) | ||
|
||
async def authenticate_async( | ||
self, | ||
token: str, | ||
) -> AuthenticateResponse: | ||
headers: Dict[str, str] = {} | ||
data: Dict[str, Any] = { | ||
"token": token, | ||
} | ||
|
||
url = self.api_base.url_for("/v1/b2b/impersonation/authenticate", data) | ||
res = await self.async_client.post(url, data, headers) | ||
return AuthenticateResponse.from_json(res.response.status, res.json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# !!! | ||
# WARNING: This file is autogenerated | ||
# Only modify code within MANUAL() sections | ||
# or your changes may be overwritten later! | ||
# !!! | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Optional | ||
|
||
from stytch.b2b.models.mfa import MfaRequired | ||
from stytch.b2b.models.organizations import Member, Organization | ||
from stytch.b2b.models.sessions import MemberSession | ||
from stytch.core.response_base import ResponseBase | ||
|
||
|
||
class AuthenticateResponse(ResponseBase): | ||
member_id: str | ||
organization_id: str | ||
member: Member | ||
session_token: str | ||
session_jwt: str | ||
organization: Organization | ||
intermediate_session_token: str | ||
member_authenticated: bool | ||
member_session: Optional[MemberSession] = None | ||
mfa_required: Optional[MfaRequired] = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "12.1.0" | ||
__version__ = "12.2.0" |