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

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

Open
marinabuezo opened this issue Sep 4, 2024 · 2 comments
Open
Assignees
Labels
question Further information is requested

Comments

@marinabuezo
Copy link

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

  • pip install box-sdk-gen
  • copy code:
  • from box_sdk_gen import BoxClient, BoxDeveloperTokenAuth

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 Insert my developer token from configuration page
  • I run script
  • gives me error

Expected Behavior

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
Copy link
Contributor

mwwoda commented Sep 5, 2024

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

@lukaszsocha2
Copy link
Contributor

Hi @marinabuezo,
did you manage to resolve your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants