Skip to content

Commit

Permalink
fix: Force Selecting Account when logging in via the CLI (#2484)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreituicu authored Jan 29, 2025
1 parent a3209d6 commit c0e9c41
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/up.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default class UpCommand extends AbstractServerCommand {
.withOrg(org)
.withSiteLoginUrl(
// TODO switch to production URL
`https://admin.hlx.page/login/${org}/${site}/main?client_id=aem-cli&redirect_uri=${encodeURIComponent(`http://localhost:${this._httpPort}/.aem/cli/login/ack`)}`,
`https://admin.hlx.page/login/${org}/${site}/main?client_id=aem-cli&redirect_uri=${encodeURIComponent(`http://localhost:${this._httpPort}/.aem/cli/login/ack`)}&selectAccount=true`,
);
}

Expand Down
12 changes: 6 additions & 6 deletions test/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ describe('Helix Server', () => {
.withCwd(cwd)
.withHttpPort(3000)
.withProxyUrl('http://main--foo--bar.aem.page')
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack');
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack&selectAccount=true');

await project.init();
project.log.level = 'silly';
Expand All @@ -463,7 +463,7 @@ describe('Helix Server', () => {
});
assert.strictEqual(resp.status, 302);
assert.ok(
resp.headers.get('location').startsWith('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack&state='),
resp.headers.get('location').startsWith('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack&selectAccount=true&state='),
);
} finally {
await project.stop();
Expand All @@ -476,7 +476,7 @@ describe('Helix Server', () => {
.withCwd(cwd)
.withHttpPort(3000)
.withProxyUrl('http://main--foo--bar.aem.page')
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack');
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack&selectAccount=true');

await project.init();
project.log.level = 'silly';
Expand Down Expand Up @@ -509,7 +509,7 @@ describe('Helix Server', () => {
.withCwd(cwd)
.withHttpPort(3000)
.withProxyUrl('http://main--foo--bar.aem.page')
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack');
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack&selectAccount=true');

await project.init();
project.log.level = 'silly';
Expand Down Expand Up @@ -591,7 +591,7 @@ describe('Helix Server', () => {
.withCwd(cwd)
.withHttpPort(3000)
.withProxyUrl('http://main--foo--bar.aem.page')
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack');
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack&selectAccount=true');

await project.init();
project.log.level = 'silly';
Expand Down Expand Up @@ -637,7 +637,7 @@ describe('Helix Server', () => {
.withCwd(cwd)
.withHttpPort(3000)
.withProxyUrl('http://main--foo--bar.aem.page')
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack');
.withSiteLoginUrl('https://admin.hlx.page/login/bar/foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F.aem%2Fcli%2Flogin%2Fack&selectAccount=true');

await project.init();
project.log.level = 'silly';
Expand Down
4 changes: 2 additions & 2 deletions test/up-cmd.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ describe('Integration test for up command with helix pages', function suite() {
resp.headers
.get('location')
.startsWith(
'https://admin.hlx.page/login/adobe/dummy-foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A0%2F.aem%2Fcli%2Flogin%2Fack&state=',
'https://admin.hlx.page/login/adobe/dummy-foo/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A0%2F.aem%2Fcli%2Flogin%2Fack&selectAccount=true&state=',
),
);
} catch (e) {
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('Integration test for up command with helix pages', function suite() {
resp.headers
.get('location')
.startsWith(
'https://admin.hlx.page/login/adobe/dummy/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A0%2F.aem%2Fcli%2Flogin%2Fack&state=',
'https://admin.hlx.page/login/adobe/dummy/main?client_id=aem-cli&redirect_uri=http%3A%2F%2Flocalhost%3A0%2F.aem%2Fcli%2Flogin%2Fack&selectAccount=true&state=',
),
);
} catch (e) {
Expand Down

0 comments on commit c0e9c41

Please sign in to comment.