find_scitoken

igwn_auth_utils.find_scitoken(audience, scope, issuer=None, timeleft=600, skip_errors=True, **kwargs)[source]

Find and load a SciToken for the given audience and scope.

Parameters:
audience

the required audience (aud).

scope

the required scope (scope).

issuer=None

the value of the iss claim to enforce.

timeleft=600

minimum required time left until expiry (in seconds) for a token to be considered ‘valid’

skip_errors=True

skip over errors encoutered when attempting to deserialise discovered tokens; this may be useful to skip over invalid or expired tokens that exist, for example, which is why it is the default behaviour.

**kwargs

all keyword arguments are passed on to scitokens.SciToken.deserialize()

Returns:

token – the first token that matches the requirements

Return type:

scitokens.SciToken

Raises:

IgwnAuthError – if no valid token can be found

See also

scitokens.SciToken.deserialize

for details of the deserialisation, and any valid keyword arguments