Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Java code to get the authorization code and access code

New post

Comments

3 comments

  • mwiller

     This step in the OAuth2 flow represents literally redirecting a user who is accessing your service via a web browser or mobile device to the Box authorization URL where they will log in with their credentials and verify that your application is permitted to access their Box account.  Exactly how this redirect is performed depends on what web framework or mobile device you're running your service on.

     

    In the event that you're not running a web or mobile application and instead want to generate tokens programmatically (without an end user providing their credentials), JWT Authentication is a better option.  You can read more about why you might want to choose JWT authand how to get started using JWT auth in the Box Developer documentation. 

    0
    Comment actions Permalink
  • kalyanch

     

    Thanks for your immediate response  but as part of our requirement in our use case need to follow oauth2 instead of JWT.Could  you have sample code using oauth2 approach instead of JWT and it will be helpful for us to proceed.

     

    Thanks & Regards,

    Kalyan

    0
    Comment actions Permalink
  • mwiller

     Unfortunately, I can't give you sample code for how to redirect a user; it really depends on the exact framework you're using and/or what platform you're on (web server vs mobile device).  For a web application, you should send the user who made the request to your service a 302 status code with a Location header whose value is the Box authorization URL.  On mobile, you'd likely want to open a webview to that same URL.

    0
    Comment actions Permalink

Please sign in to leave a comment.