Skip to content

Commit baaf79f

Browse files
committed
fix: update redirect uri
1 parent 83ccb14 commit baaf79f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/webOAuthServer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ const messages = Messages.loadMessages('@salesforce/core', 'auth');
2828
// Server ignores requests for site icons
2929
const iconPaths = ['/favicon.ico', '/apple-touch-icon-precomposed.png'];
3030

31-
const CODE_BUILDER_REDIRECT_URI = 'api/oauth2/salesforce/callback';
31+
const CODE_BUILDER_REDIRECT_URI_STAGE =
32+
'https://api.code-builder-stg.platform.salesforce.com/api/oauth/salesforce/callback';
33+
const CODE_BUILDER_REDIRECT_URI_PROD = 'https://api.code-builder.platform.salesforce.com/api/oauth/salesforce/callback';
3234

3335
/**
3436
* Handles the creation of a web server for web based login flows.
@@ -216,8 +218,8 @@ export class WebOAuthServer extends AsyncCreatable<WebOAuthServer.Options> {
216218
CODE_BUILDER_URI: cbUri,
217219
CODE_BUILDER_STATE_SHA: cbStateSha,
218220
});
219-
const maybeSlash = this.oauthConfig.loginUrl.endsWith('/') ? '' : '/';
220-
this.oauthConfig.redirectUri = `${this.oauthConfig.loginUrl}${maybeSlash}${CODE_BUILDER_REDIRECT_URI}`;
221+
const cbProd = env.getBoolean('CODE_BUILDER_PROD');
222+
this.oauthConfig.redirectUri = cbProd ? CODE_BUILDER_REDIRECT_URI_PROD : CODE_BUILDER_REDIRECT_URI_STAGE;
221223
} else {
222224
this.oauthConfig.clientId ??= DEFAULT_CONNECTED_APP_INFO.clientId;
223225
this.oauthConfig.redirectUri ??= `http://localhost:${port}/OauthRedirect`;

0 commit comments

Comments
 (0)