Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIError #14

Closed
pruebasft opened this issue Apr 22, 2020 · 4 comments
Closed

APIError #14

pruebasft opened this issue Apr 22, 2020 · 4 comments

Comments

@pruebasft
Copy link

Hi,
I have an error when I run the script

this is my script example.py

import sys
from appstoreconnect import Api

if __name__ == "__main__":
        key_id = "XXXXXXXXXX"
        key_file = "AuthKey_XXXXXXXXXX.p8"	
        issuer_id ="XXXXXXXXXX-XXXXX-XXXXXXXXXXXXX"
        
        api = Api(key_id, key_file, issuer_id)
        apps = api.list_apps()

        print (apps)
        for app in apps:
                print(app.name)

The key_file is in the same directory than example.py.
And this is the error

Traceback (most recent call last):
  File "C:\API_apple\example.py", line 26, in <module>
    for app in apps:
  File "C:\API_apple\appstoreconnect\api.py", line 80, in __next__
    self.fetch_page()
  File "C:\API_apple\appstoreconnect\api.py", line 97, in fetch_page
    self.payload = self.api._api_call(self.url)
  File "C:\API_apple\appstoreconnect\api.py", line 135, in _api_call
    raise APIError(payload.get('errors', [])[0].get('detail', 'Unknown error'))
appstoreconnect.api.APIError: Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens

What is happening ?

Thanks

@ppawlak
Copy link
Contributor

ppawlak commented Apr 22, 2020

I'm not really sure I can tell why.
In a previous version of the library we had a bug with token expiration. Which version are you using?

@pruebasft
Copy link
Author

It's this:
Version: 0.7.0

@ppawlak
Copy link
Contributor

ppawlak commented Apr 24, 2020

Version: 0.7.0

This should be fine with the expiration bug then.

I had just made a test. The error you have can happen if either the key_id or issuer_id is wrong. Can you double check them?

@ppawlak
Copy link
Contributor

ppawlak commented May 20, 2020

I am closing this issue as I am not able to reproduce it.
Fell free to re-open it.

@ppawlak ppawlak closed this as completed May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants