Welcome to the new Box Support website. Check out all the details here on what’s changed.

Authorization through python

Answered
New post

Comments

6 comments

  • mwiller

     It sounds like your application may be using Server Auth with JWT instead of Standard OAuth2.  If this is the case, please try using the instructions at https://github.com/box/box-python-sdk#box-developer-edition to set up your application; that should fix the grant type error you're seeing.

    0
    Comment actions Permalink
  • xdsouza5

     I am confused now. Please clarify

    1. The authorization method I have posted in Question is  - standard OAuth2 ?  I have not used any jwt auth yet. I generated a developer token by logging into my account, used this as the access token in my python script and it worked for me for first 60 minutes. After which I started getting the auth error.

    2. Now given my requirement that - the client id and client secret is configured in an automated python script which would run once a week(cron job) to upload a file - Which auth method would you suggest?

     

    Thanks 

    0
    Comment actions Permalink
  • mwiller

     In the Box Developer Console, if you go to the Configuration page for your application, you'll see a section marked "Authentication Method" at the top of the page.  If this is set to "OAuth 2.0 with JWT", then you'll need to update your code as I mentioned.  Otherwise, if "Standard OAuth 2.0" is selected, then there may be some other problem.

    0
    Comment actions Permalink
  • xdsouza5

     so what I learned is that the developer token expires in 60 minutes. So the error I get is expected.

    So, for a production like environment set-up, it's not possible to manually log-in and generate the developer token every time.

     

    So - you mean I need to go with auth-method - OAuth2.0 with JWT to suffice my requirement or is there any other method another than developer token which would suffice? 

     

    What I am expecting is - the auth type suitable for my requirement

     

    Thanks again

     

    0
    Comment actions Permalink
  • mwiller

     For the use case you described (an automated cron job), the JWT auth type is the most suitable.

    0
    Comment actions Permalink
  • xdsouza5

    Thanks 

    0
    Comment actions Permalink

Please sign in to leave a comment.