Skip to content

Calling get_authorization_code cause TypeError: can only concatenate str (not "NoneType") to str #584

@mlepine

Description

@mlepine

When attempting to get an authorization code a TypeError is thrown. This looks to be caused by attempting to create a cache key using the refresh token which hasn't been created yet.

  File "/Users/mike/.virtualenvs/api/lib/python3.7/site-packages/sp_api/api/authorization/authorization.py", line 43, in get_authorization_code
    return self._request_grantless_operation(kwargs.pop('path'),  params=kwargs)
  File "/Users/mike/.virtualenvs/api/lib/python3.7/site-packages/sp_api/base/client.py", line 151, in _request_grantless_operation
    'x-amz-access-token': self.grantless_auth.access_token,
  File "/Users/mike/.virtualenvs/api/lib/python3.7/site-packages/sp_api/base/client.py", line 80, in grantless_auth
    return self._auth.get_grantless_auth(self.grantless_scope)
  File "/Users/mike/.virtualenvs/api/lib/python3.7/site-packages/sp_api/auth/access_token_client.py", line 85, in get_grantless_auth
    cache_key = self._get_cache_key(scope)
  File "/Users/mike/.virtualenvs/api/lib/python3.7/site-packages/sp_api/auth/access_token_client.py", line 145, in _get_cache_key
    (token_flavor + self.cred.refresh_token).encode('utf-8')
TypeError: can only concatenate str (not "NoneType") to str

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions