How to use Python to automatically get access token without open the web page
Hi all,
Currently, I am starting a Python script to automatically download a file from box every day, but the access token is set to expire within 60 mins, so I need to find a way to use Python code to refresh the access token, I search through the community and some helpful pages said it will require a refresh token, but I can not find it anywhere. Could you please kindly tell me how to do that or suggest a better way to solve this scenario?
Thanks!
-
Have you checked out our Python SDK? It sounds like this would meet your needs.
Best,
Kourtney
-
Thanks for your reply, I have checked this page and test several ways. I can use Python sdk with JWT authentication (public/private key) to get the client and already made the enterprise authorization, but it will always return 404 error when I want to get the specific file or folder.
-
If you're using JWT auth, it means that your default token is going to be for the application's service account. This means you'll only be able to interact with the content you've added your AutomationUser as a collaborator on or what they own.
You either need to change your JWT assertion and get a token for a user who has access to the content currently, or add the AutomationUser as a collaborator on the content.
Best,
Kourtney
Please sign in to leave a comment.
Comments
3 comments