Skip to main content
Question

Using Python to OAuth for leveraging Box API

  • May 22, 2025
  • 2 replies
  • 29 views

Forum|alt.badge.img

https://developer.box.com/docs/authenticate-with-oauth-2

 

I am getting stuck in the Step 1: Add Dependencies

 

import config_oauth

There doesn't exist any such library.

 

What all I tried:

- I have installed oauth2 as well using pip.

- tried from boxsdk import config_oauth

 

Doesn't work.

2 replies

Forum|alt.badge.img

Hi ,

 

I took a look over the docs and you're right, what's there could be a bit confusing for what the config file actually is.

 

The config is essentially a file that you create (e.g. config.py) that houses a few variables that are needed for the app. The contents of the Python config would look like this:

 

# Auth config
client_id = 'YOUR CLIENT ID'
client_secret='YOUR CLIENT SECRET'
redirect_uri = 'http://127.0.0.1:5000/return'

That's the config.py file that is being referenced in the docs. I have also added a more detailed explanation to step 1 of the docs to walk through that content as well. 

 

I also have a number of working application examples in Python (JWT & OAuth) here if you want to see a working example. I'm working on moving those over to the docs as well.

 

Thanks,

Jon


Forum|alt.badge.img

Hi

 

Thank you for your contribution. I am sorry but I am still a little lost on how to proceed. I'm sure it is because I'm new to Python.

I copy your code, using my CLIENT ID and CLIENT SECRET.

However, when I try to run the application, nothing happens.

 

I am using "app.run()". Is that ok?

This is what I get.

 

app.run()
 * Serving Flask app "" (lazy loading)
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off