module documentation
This module implements OAuth token retrieval.
| Function | get |
Retrieve and return a oauth2 token. If there is a provided token that is still valid, then that token is returned. |
| Variable | |
A named tuple for a token. |
| Variable | _expiration |
Leeway for token expiration. |
def getOAuthToken(serverURL:
str, clientID: str, clientSecret: str, token: Token | None = None, kind: str | None = 'keycloak') -> Token | None:
¶
Retrieve and return a oauth2 token. If there is a provided token that is still valid, then that token is returned.
This function returns a new named tuple Token(token, expiration), or None in case of an error. The expiration is in epoch seconds.
| Parameters | |
serverstr | The URL of the OAuth server. |
clientstr | The client ID. |
clientstr | The client secret. |
token:Token | None | Optional token to check if it is still valid. |
kind:str | None | The kind of OAuth server. Currently only 'keycloak' is supported. |
| Returns | |
Token | None | A Token tuple or None in case of an error. |