Source code for globus_sdk.authorizers.access_token

import logging

from globus_sdk import utils

from .base import StaticGlobusAuthorizer

log = logging.getLogger(__name__)


[docs]class AccessTokenAuthorizer(StaticGlobusAuthorizer): """ Implements Authorization using a single Access Token with no Refresh Tokens. This is sent as a Bearer token in the header -- basically unadorned. :param access_token: An access token for Globus Auth :type access_token: str """ def __init__(self, access_token: str): log.info( "Setting up an AccessTokenAuthorizer. It will use an " "auth type of Bearer and cannot handle 401s." ) self.access_token = access_token self.header_val = "Bearer %s" % access_token self.access_token_hash = utils.sha256_string(self.access_token) log.debug(f'Bearer token has hash "{self.access_token_hash}"')