find_scitoken

igwn_auth_utils.find_scitoken(audience, scope, issuer=None, timeleft=60, skip_errors=True, warn=False, **kwargs)

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

Parameters:
  • audience (str) – the required audience (aud).

  • scope (str) – the required scope (scope).

  • issuer (str) – the value of the iss claim to enforce.

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

  • skip_errors (bool, optional) – 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.

  • warn (bool) – emit a warning when a token fails to deserialize, or fails validation.

  • 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