Skip to content

Commit cc089ce

Browse files
authored
Merge pull request #295 from Cox-Automotive/basic-auth-dep-announce
Add basic auth deprecation warnings for May 3rd retirement
2 parents 3577d49 + 3f38aac commit cc089ce

File tree

5 files changed

+54
-1
lines changed

5 files changed

+54
-1
lines changed

changelog.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ Thanks for upgrading to the latest version of the ALKS CLI!
77
- Type to filter accounts by alias or account ID instead of scrolling
88
- Uses case-insensitive substring matching
99

10+
★ Release Notes: 2026-02-24 ★
11+
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
12+
13+
Thanks for upgrading to the latest version of the ALKS CLI!
14+
15+
* Added deprecation warning for Basic Authentication (US1879500).
16+
- A warning banner now appears whenever a command runs using basic auth (network password)
17+
- Basic Authentication will be retired on May 3rd; please migrate to OAuth2 via `alks developer configure`
18+
1019
Have feedback? https://github.com/Cox-Automotive/ALKS-CLI/issues
1120

1221
☁☁☁☁☁☁ Happy Clouding! ☁☁☁☁☁☁

src/lib/getAlks.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import ALKS, { AlksProps, create } from 'alks.js';
2+
import { yellow } from 'cli-color';
23
import { getUserAgentString } from './getUserAgentString';
4+
import { defaultServer } from './promptForServer';
35
import { getServer } from './state/server';
46

57
interface TokenProps {
@@ -30,6 +32,20 @@ export async function getAlks(props: Props): Promise<ALKS.Alks> {
3032
);
3133
}
3234

35+
const normalizedServer = server.replace(/\/+$/, '');
36+
const normalizedDefault = defaultServer.replace(/\/+$/, '');
37+
const defaultOrigin = defaultServer.replace(/\/rest\/?$/, '');
38+
if (
39+
normalizedServer !== normalizedDefault &&
40+
normalizedServer.startsWith(defaultOrigin)
41+
) {
42+
console.error(
43+
yellow(
44+
`Tip: Did you mean ${defaultServer}? Run \`alks developer configure\` to update your server URL.`
45+
)
46+
);
47+
}
48+
3349
// FYI: for enabled but not enforced we should not send the Test header.
3450
const mergedHeaders = {
3551
...(props.headers || {}),

src/lib/getAuth.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import { yellow } from 'cli-color';
12
import { log } from '../lib/log';
23
import { Auth } from '../model/auth';
34
import { promptForPassword } from './promptForPassword';
5+
import { showBorderedMessage } from './showBorderedMessage';
46
import { getPassword } from './state/password';
57
import { getToken } from './state/token';
68
import { getUserId } from './state/userId';
79

10+
let deprecationWarningShown = false;
11+
812
// TODO: refactor all calls to this function to do their own error handling so that we can just return Auth or undefined
913
export async function getAuth(): Promise<Auth> {
1014
log('checking for refresh token');
@@ -23,6 +27,19 @@ export async function getAuth(): Promise<Auth> {
2327
}
2428
// If password is not set, ask for a password
2529
const password = (await getPassword()) || (await promptForPassword());
30+
31+
if (!deprecationWarningShown) {
32+
deprecationWarningShown = true;
33+
showBorderedMessage(
34+
80,
35+
yellow(
36+
'⚠ DEPRECATION WARNING: Basic Authentication (network password) will be\n' +
37+
' retired on May 3rd. Please run `alks developer configure` to migrate\n' +
38+
' to OAuth2 (refresh token) authentication.'
39+
)
40+
);
41+
}
42+
2643
const auth = { userid, password };
2744
return auth;
2845
}

src/lib/handlers/alks-developer-login.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
import commander from 'commander';
2+
import { yellow } from 'cli-color';
23
import { checkForUpdate } from '../checkForUpdate';
34
import { errorAndExit } from '../errorAndExit';
45
import { log } from '../log';
56
import { promptForPassword } from '../promptForPassword';
67
import { promptForUserId } from '../promptForUserId';
8+
import { showBorderedMessage } from '../showBorderedMessage';
79
import { setPassword } from '../state/password';
810
import { setUserId } from '../state/userId';
911

1012
export async function handleAlksDeveloperLogin(
1113
options: commander.OptionValues
1214
) {
1315
try {
16+
showBorderedMessage(
17+
80,
18+
yellow(
19+
'⚠ DEPRECATION WARNING: Basic Authentication (network password) will be\n' +
20+
' retired on May 3rd. Please use `alks developer configure` to set up\n' +
21+
' OAuth2 (refresh token) authentication instead.'
22+
)
23+
);
24+
1425
const userId = options.username ?? (await promptForUserId());
1526
log('saving user ID');
1627
await setUserId(userId);

src/lib/promptForAuthType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export async function promptForAuthType(): Promise<string> {
1818
short: REFRESH_TOKEN_AUTH_CHOICE,
1919
},
2020
{
21-
name: `[${PASSWORD_AUTH_CHOICE}] Store your network password (not recommended)`,
21+
name: `[${PASSWORD_AUTH_CHOICE}] Store your network password (DEPRECATED - retiring May 3rd, not recommended)`,
2222
value: PASSWORD_AUTH_CHOICE,
2323
short: PASSWORD_AUTH_CHOICE,
2424
},

0 commit comments

Comments
 (0)