oauth2.store — Storing and retrieving data¶
Store adapters to persist and retrieve data during the OAuth 2.0 process or for later use. This module provides base classes that can be extended to implement your own solution specific to your needs. It also includes implementations for popular storage systems like memcache.
Data types¶
- class oauth2.datatype.AccessToken(client_id, grant_type, token, data={}, expires_at=None, refresh_token=None, scopes=[])[source]¶
An access token and associated data.
Base classes¶
- class oauth2.store.AccessTokenStore[source]¶
Base class for persisting an access token after it has been generated.
Used in two-legged and three-legged authentication flows.
- fetch_by_refresh_token(refresh_token)[source]¶
Fetches an access token from the store using its refresh token to identify it.
Parameters: refresh_token – A string containing the refresh token.
- save_token(access_token)[source]¶
Stores an access token and additional data.
Parameters: access_token – An instance of oauth2.datatype.AccessToken.
- class oauth2.store.AuthCodeStore[source]¶
Base class for writing and retrieving an auth token during the Authorization Code Grant flow.
- fetch_by_code(code)[source]¶
Returns an AuthorizationCode fetched from a storage.
Parameters: code – The authorization code. Returns: An instance of oauth2.datatype.AuthorizationCode. Raises: AuthCodeNotFound if no data could be retrieved for given code.