benchling_sdk.auth.client_credentials_oauth2 module¶
- class ClientCredentialsOAuth2¶
- Bases: - benchling_api_client.v2.benchling_client.AuthorizationMethod- OAuth2 client credentials for authorization. - Use in combination with the Benchling() client constructor to be authorized with OAuth2 client_credentials grant type. - __init__(client_id: str, client_secret: str, token_url: Optional[str] = None)¶
- Initialize ClientCredentialsOAuth2. - Parameters
- client_id – Client id in client_credentials grant type 
- client_secret – Client secret in client_credentials grant type 
- token_url – A fully-qualified URL pointing at the access token request endpoint such as https://benchling.com/api/v2/token. Can be omitted to default to /api/v2/token appended to the server base URL. 
 
 
 
- class Token¶
- Bases: - object- Represents an OAuth2 token response model. - __init__(access_token: str, refresh_time: datetime)¶
- Initialize Token. - Parameters
- access_token – The raw token value for authorizing with the API 
- refresh_time – Calculated value off of token time-to-live for when a new token should be generated. 
 
 
 - classmethod from_token_response(token_response)¶
- Construct Token from deserializing token endpoint response. - Deserializes response from token endpoint and calculates expiry time with buffer for when token should be regenerated. - Parameters
- token_response – The response from an RFC6749 POST /token endpoint. 
 
 
