Skip to main content

Box headless OAuth2 client

Project description

Python OAuth2 Headless Client for Box

Python package to help connect with a Box API in cases where you don't have access to get the JWT file (better long term solution). In cases where you want to connect to the Box API through OAuth2 in a headless manner (without a browser) this can help


This package depends on keyring, selenium, and boxsdk. Since selenium runs in headless mode, you will need to make sure chromedriver is installed on your machine (this is done outside of pip unfortunately).

For instructions on how to do this, see here


Login to Box through OAuth2

from box_auth.box_auth import BoxAuth

box = BoxAuth(
    client_id, # From Box developer console
    client_secret, # From box developer console
    user_email # This is used by your keyring

box.login() # Login

print(box.get_current_user()) # Double check that it worked

To get the boxsdk client, just run:

Client = box.get_client()

Follow the boxsdk documentation for how to use the client to access box


You need the following variables in a file (root directory) for the tests to work

client_id = # You can find this in the developer console, under your app configuration
client_secret =  # ""
box_username =
user_email # This is used by your keyring to store the access and refresh token
user # This is used by tests to check that you are the correct user

Then from the root directory, simply run



As a pip package

pip install box_oauth



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

box_oauth-0.3.1.tar.gz (4.0 kB view hashes)

Uploaded source

Built Distribution

box_oauth-0.3.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page