Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e6fc49a
Add OAuth Device Authorization Grant login flow
umair-ably Apr 15, 2026
e7b5552
Add OAuth login and logout commands
umair-ably Apr 15, 2026
2f02283
Add multi-account selection and switching
umair-ably Apr 15, 2026
4640575
Add tests for OAuth login flow
umair-ably Apr 15, 2026
3f16378
Fix logout host resolution and mock config fallbacks
umair-ably Apr 16, 2026
6a00ccd
Fix accounts current to use getAccessToken for OAuth compatibility
umair-ably Apr 16, 2026
c1a2ba4
Harden OAuth session scoping, error handling, and test mock fidelity
umair-ably Apr 16, 2026
5ffa0f7
Address OAuth review findings from ultrareview
umair-ably Apr 17, 2026
3173827
Separate OAuth authorization host from Control API host
umair-ably Apr 20, 2026
e494984
Simplify OAuth error handling now that server is RFC 6749 compliant
umair-ably Apr 20, 2026
bc8addc
Surface the selected account before app/key prompts in login
umair-ably Apr 20, 2026
76e72b3
Clean Ctrl+C handling during OAuth device-code polling
umair-ably Apr 20, 2026
9e42acb
Honour stored account hosts so commands don't need --control-host
umair-ably Apr 20, 2026
114392a
Use the `slugify` npm package instead of a hand-rolled regex
umair-ably Apr 20, 2026
98ed158
Login now extends ControlBaseCommand
umair-ably Apr 21, 2026
0f5a81d
use formatResource helper for login auth code
umair-ably Apr 21, 2026
c000240
Stop reading user identity from the OAuth token response
umair-ably Apr 21, 2026
07b9e16
Honour stored controlHost in the auth-info banner lookup
umair-ably Apr 27, 2026
ed0aa49
Refine the controlHost regression test's mock reset
umair-ably Apr 27, 2026
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"ora": "^9.3.0",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"slugify": "^1.6.9",
"smol-toml": "^1.6.1",
"ws": "^8.20.0",
"zod": "^3.25.76"
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions src/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ export abstract class AblyBaseCommand extends InteractiveBaseCommand {
constructor(argv: string[], config: CommandConfig) {
super(argv, config);
this.configManager = createConfigManager();
this.interactiveHelper = new InteractiveHelper(this.configManager);
this.interactiveHelper = new InteractiveHelper(this.configManager, {
log: this.log.bind(this),
});
// Check if we're running in web CLI mode
this.isWebCliMode = isWebCliMode();
}
Expand Down Expand Up @@ -614,15 +616,24 @@ export abstract class AblyBaseCommand extends InteractiveBaseCommand {
if (!appName) {
try {
// Get access token for control API
const currentAccount = this.configManager.getCurrentAccount();
const accessToken =
process.env.ABLY_ACCESS_TOKEN || currentAccount?.accessToken;
process.env.ABLY_ACCESS_TOKEN ||
this.configManager.getAccessToken();

if (accessToken) {
// Mirror createControlApi's host precedence (flag → env → stored
// account host) so the banner's app-name lookup honours the host
// the user picked at login. Without the account fallback this
// call silently targets control.ably.net even when the user
// logged in against a review/staging deployment, the lookup
// 404s, and the banner downgrades to "Unknown App".
const account = this.configManager.getCurrentAccount();
const controlApi = new ControlApi({
accessToken,
controlHost:
flags["control-host"] || process.env.ABLY_CONTROL_HOST,
flags["control-host"] ??
process.env.ABLY_CONTROL_HOST ??
account?.controlHost,
});
const app = await controlApi.getApp(appId);
appName = app.name;
Expand Down
12 changes: 4 additions & 8 deletions src/commands/accounts/current.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
extractKeyNameFromApiKey,
} from "../../utils/api-key.js";
import { errorMessage } from "../../utils/errors.js";
import { ControlApi } from "../../services/control-api.js";
import { formatLabel } from "../../utils/output.js";

export default class AccountsCurrent extends ControlBaseCommand {
Expand Down Expand Up @@ -42,14 +41,11 @@ export default class AccountsCurrent extends ControlBaseCommand {
);
}

// Verify the account by making an API call to get up-to-date information
// Verify the account by making an API call to get up-to-date information.
// Route through createControlApi so OAuth accounts get the same
// TokenRefreshMiddleware used by every other control command.
try {
const { accessToken } = currentAccount;

const controlApi = new ControlApi({
accessToken,
controlHost: flags["control-host"],
});
const controlApi = this.createControlApi(flags);

const { account, user } = await controlApi.getMe();

Expand Down
Loading
Loading