adp.core.authentication.get_access_token

adp.core.authentication.get_access_token(scope: str) dict[str, Any]

get_access_token retrieves an AccessToken for the client

Behaviour of this function depends on the context (where it runs). When a refresh token (global variable) is specified then it just retrieves a new token by using the refresh token. When no refresh token is specified:

  1. When service principal secret is specified, use client secret

In all cases: save the newly retrieved refresh token in the global variable. This will be used the next time when retrieving an accesstoken.

Parameters:

scopes (List[str]) – a list of scopes for which to retreive an accesstoken

Raises:

AuthenticationError – raises this error when a the accesstoken cannot be retrieved

Returns:

a dictionary containing the access- and refreshtoken

Return type:

dict