Skip to content

Commit

Permalink
fix: Support OAuth with multiple redirect URIs (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhagmajer authored Apr 8, 2022
1 parent 4cab9be commit 9fe216e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/commands/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class OAuthLoginCommand extends BoxCommand {
const { flags } = this.parse(OAuthLoginCommand);
const environmentsObj = await this.getEnvironments();
const port = flags.port;
const redirectUri = `http://localhost:${port}/callback`;

this.info(
chalk`{cyan If you are not using the quickstart guide to set up ({underline https://developer.box.com/guides/tooling/cli/quick-start/}) then go to the Box Developer console ({underline https://cloud.app.box.com/developers/console}) and:}`
Expand All @@ -30,7 +31,7 @@ class OAuthLoginCommand extends BoxCommand {
chalk`{cyan 1. Select an application with OAuth user authentication method. Create a new Custom App if needed.}`
);
this.info(
chalk`{cyan 2. Click on the Configuration tab and set the Redirect URI to: {italic http://localhost:${port}/callback}. Click outside the input field.}`
chalk`{cyan 2. Click on the Configuration tab and set the Redirect URI to: {italic ${redirectUri}}. Click outside the input field.}`
);
this.info(chalk`{cyan 3. Click on {bold Save Changes}.}`);

Expand Down Expand Up @@ -130,6 +131,7 @@ class OAuthLoginCommand extends BoxCommand {
const authorizeUrl = sdk.getAuthorizeURL({
response_type: 'code',
state,
redirect_uri: redirectUri,
});

open(authorizeUrl);
Expand Down

0 comments on commit 9fe216e

Please sign in to comment.