box / box-python-sdk-gen

Repository for generated Box Python SDK
Apache License 2.0
25 stars 5 forks source link

Message: Developer token has expired. Please provide a new one. #298

Open marinabuezo opened 1 week ago

marinabuezo commented 1 week ago

Description of the Issue

I am trying to use https://github.com/box/box-python-sdk-gen?tab=readme-ov-file#installing to connect to box so that I can download and upload files. I have tried getting a Developer Token from the Configuration page and inserting into code. I then try to run the code but get this issue: Message: Developer token has expired. Please provide a new one.

Steps to Reproduce

def main(token: str): auth: BoxDeveloperTokenAuth = BoxDeveloperTokenAuth(token=token) client: BoxClient = BoxClient(auth=auth) for item in client.folders.get_folder_items('0').entries: print(item.name)

if name == 'main': main('INSERT YOUR DEVELOPER TOKEN HERE')

I expected it to be able to connect to my box

Error Message, Including Stack Trace

Screenshots

attached

Screenshot 2024-09-04 at 2 07 23 PM

Versions Used

Python: Python 3.11.8

mwwoda commented 1 week ago

Developer tokens are usually short-lived. It is possible that yours has expired before the call was made. You can try making the same call with cURL to make sure it's not a problem with the SDK itself - https://developer.box.com/reference/get-folders-id/

curl -i -X GET "https://api.box.com/2.0/folders/0" \
     -H "authorization: Bearer <ACCESS_TOKEN>"

If problem still persist I recommend reaching out to our forums