diff --git a/awxkit/awxkit/api/client.py b/awxkit/awxkit/api/client.py index 7844a7fa1131..77c71a569b1f 100644 --- a/awxkit/awxkit/api/client.py +++ b/awxkit/awxkit/api/client.py @@ -15,12 +15,11 @@ class ConnectionException(exc.Common): class Token_Auth(requests.auth.AuthBase): - def __init__(self, token, auth_type='Token'): + def __init__(self, token): self.token = token - self.auth_type = auth_type def __call__(self, request): - request.headers['Authorization'] = '{0.auth_type} {0.token}'.format(self) + request.headers['Authorization'] = 'Bearer {0.token}'.format(self) return request @@ -57,7 +56,7 @@ def login(self, username=None, password=None, token=None, **kwargs): else: self.session.auth = (username, password) elif token: - self.session.auth = Token_Auth(token, auth_type=kwargs.get('auth_type', 'Token')) + self.session.auth = Token_Auth(token) else: self.session.auth = None diff --git a/awxkit/awxkit/awx/utils.py b/awxkit/awxkit/awx/utils.py index 2238297b675e..d25e555ad66a 100644 --- a/awxkit/awxkit/awx/utils.py +++ b/awxkit/awxkit/awx/utils.py @@ -90,7 +90,7 @@ def as_user(v, username, password=None): if session_id: del connection.session.cookies['sessionid'] if access_token: - kwargs = dict(token=access_token, auth_type='Bearer') + kwargs = dict(token=access_token) else: kwargs = connection.get_session_requirements() else: diff --git a/awxkit/awxkit/cli/client.py b/awxkit/awxkit/cli/client.py index 3feded89dc10..f14d6df13537 100755 --- a/awxkit/awxkit/cli/client.py +++ b/awxkit/awxkit/cli/client.py @@ -88,7 +88,7 @@ def authenticate(self): token = self.get_config('token') if token: self.root.connection.login( - None, None, token=token, auth_type='Bearer' + None, None, token=token, ) else: config.use_sessions = True