Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ Thanks for upgrading to the latest version of the ALKS CLI!
- Type to filter accounts by alias or account ID instead of scrolling
- Uses case-insensitive substring matching

★ Release Notes: 2026-02-24 ★
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

Thanks for upgrading to the latest version of the ALKS CLI!

* Added deprecation warning for Basic Authentication (US1879500).
- A warning banner now appears whenever a command runs using basic auth (network password)
- Basic Authentication will be retired on May 3rd; please migrate to OAuth2 via `alks developer configure`

Have feedback? https://github.com/Cox-Automotive/ALKS-CLI/issues

☁☁☁☁☁☁ Happy Clouding! ☁☁☁☁☁☁
16 changes: 16 additions & 0 deletions src/lib/getAlks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import ALKS, { AlksProps, create } from 'alks.js';
import { yellow } from 'cli-color';
import { getUserAgentString } from './getUserAgentString';
import { defaultServer } from './promptForServer';
import { getServer } from './state/server';

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

const normalizedServer = server.replace(/\/+$/, '');
const normalizedDefault = defaultServer.replace(/\/+$/, '');
const defaultOrigin = defaultServer.replace(/\/rest\/?$/, '');
if (
normalizedServer !== normalizedDefault &&
normalizedServer.startsWith(defaultOrigin)
) {
console.error(
yellow(
`Tip: Did you mean ${defaultServer}? Run \`alks developer configure\` to update your server URL.`
)
);
}

// FYI: for enabled but not enforced we should not send the Test header.
const mergedHeaders = {
...(props.headers || {}),
Expand Down
17 changes: 17 additions & 0 deletions src/lib/getAuth.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { yellow } from 'cli-color';
import { log } from '../lib/log';
import { Auth } from '../model/auth';
import { promptForPassword } from './promptForPassword';
import { showBorderedMessage } from './showBorderedMessage';
import { getPassword } from './state/password';
import { getToken } from './state/token';
import { getUserId } from './state/userId';

let deprecationWarningShown = false;

// TODO: refactor all calls to this function to do their own error handling so that we can just return Auth or undefined
export async function getAuth(): Promise<Auth> {
log('checking for refresh token');
Expand All @@ -23,6 +27,19 @@ export async function getAuth(): Promise<Auth> {
}
// If password is not set, ask for a password
const password = (await getPassword()) || (await promptForPassword());

if (!deprecationWarningShown) {
deprecationWarningShown = true;
showBorderedMessage(
80,
yellow(
'⚠ DEPRECATION WARNING: Basic Authentication (network password) will be\n' +
' retired on May 3rd. Please run `alks developer configure` to migrate\n' +
' to OAuth2 (refresh token) authentication.'
)
);
}

const auth = { userid, password };
return auth;
}
Expand Down
11 changes: 11 additions & 0 deletions src/lib/handlers/alks-developer-login.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import commander from 'commander';
import { yellow } from 'cli-color';
import { checkForUpdate } from '../checkForUpdate';
import { errorAndExit } from '../errorAndExit';
import { log } from '../log';
import { promptForPassword } from '../promptForPassword';
import { promptForUserId } from '../promptForUserId';
import { showBorderedMessage } from '../showBorderedMessage';
import { setPassword } from '../state/password';
import { setUserId } from '../state/userId';

export async function handleAlksDeveloperLogin(
options: commander.OptionValues
) {
try {
showBorderedMessage(
80,
yellow(
'⚠ DEPRECATION WARNING: Basic Authentication (network password) will be\n' +
' retired on May 3rd. Please use `alks developer configure` to set up\n' +
' OAuth2 (refresh token) authentication instead.'
)
);

const userId = options.username ?? (await promptForUserId());
log('saving user ID');
await setUserId(userId);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/promptForAuthType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function promptForAuthType(): Promise<string> {
short: REFRESH_TOKEN_AUTH_CHOICE,
},
{
name: `[${PASSWORD_AUTH_CHOICE}] Store your network password (not recommended)`,
name: `[${PASSWORD_AUTH_CHOICE}] Store your network password (DEPRECATED - retiring May 3rd, not recommended)`,
value: PASSWORD_AUTH_CHOICE,
short: PASSWORD_AUTH_CHOICE,
},
Expand Down
Loading