cremalink.clients.auth module
- class cremalink.clients.auth.CloudToken(refresh_token: str)[source]
Bases:
objectResponsible for handling authentication with the Ayla IoT cloud platform. This module implements the multi-step authentication flow required to obtain a refresh token, which can be used for API interactions.
- cremalink.clients.auth.authenticate_cloud(email: str, password: str, language: str = 'en') CloudToken[source]
Performs the multi-step authentication flow to obtain a refresh token for the Ayla IoT cloud platform.
This function executes the following steps: 1. Authorize: Initiates the authorization process to obtain a context parameter. 2. Get IDs: Retrieves necessary IDs (ucid, gmid, gmid_ticket) for the login process. 3. Login: Authenticates the user with their email and password, along with risk context information, to obtain a login token. 4. Get User Info: Fetches user information using the login token to obtain UID, UIDSignature, and signatureTimestamp. 5. Consent: Simulates the user consent process to obtain a signature for the authorization continue step. 6. Authorization Continue: Continues the authorization process using the context, login token, and consent signature to obtain an authorization code. 7. IDP Token: Exchanges the authorization code for an IDP token. 8. Exchange for Ayla: Uses the IDP token to sign in to the Ayla cloud and obtain a refresh token.
- Parameters:
- Returns:
An instance of CloudToken containing the obtained refresh token.
- Return type: