Box API OAuth2.0 in script

195 Views Asked by At

I am writing a script to automate the process of regularly upload specific files to Box.

After reading the BOX API, I know I have to use client-id and client-secret to get an authentication url which open in browser, then I login in by username and password, click allow, then I get redirect to a url I provided with Auth Code attached to the end of this redirect url.

problem now is, I am writing a script not an web or mobile app. Therefore, I have to avoid these UI web html manual login.

Is there a way??? I can get this authentication url by code in python using BOX's python SDK.Then I can open a browser in python by webbrowser module then I can type in username/password. Then I get redirected. Maybe I can use some special redirect url to send auth code back to my code? I don't know how to do that.

Please help!

1

There are 1 best solutions below

0
Khurshid On

You should use JWT authentication.

Unlike the standard OAuth 2 flow, JWT will allow you to use your own identity provider to bypass the application auth and redirect. Building with JWT will allow you to hide the Box process behind the scenes.

Authenticate with JWT