Last active
November 8, 2017 23:12
-
-
Save jcleblanc/f4d16b46d5c2afdcdd00f8ec312736fe to your computer and use it in GitHub Desktop.
Quickstart OAuth auth samples - Redirect the user to Box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Redirect user to login with Box | |
String box_redirect = Config.box_redirect | |
+ "?response_type=code" | |
+ "&client_id=" + Config.client_id | |
+ "&redirect_uri=" + Config.redirect_uri; | |
res.redirect(box_redirect); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build Box auth object | |
const payload = { | |
'response_type': 'code', | |
'client_id': appConfig.oauthClientId, | |
'redirect_uri': 'http://localhost:3000/return' | |
}; | |
// Build redirect URI and redirect | |
const qs = querystring.stringify(payload); | |
const authEndpoint = `https://account.box.com/api/oauth2/authorize?${qs}`; | |
res.redirect(authEndpoint); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment