Java code to get the authorization code and access code
Hi Team,
I have gone through the api to get the authorization code for the access token and found the below code
res.redirect(box_redirect);
Could anyone provide complete code snippet for the same.
Thanks & Regards,
Kalyan
-
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.
-
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.
Please sign in to leave a comment.
Comments
3 comments