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
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,9 @@ Logs into your Internxt account using the web-based login flow. A temporary loca

```
USAGE
$ internxt login [--json] [-x] [--debug] [-h <value>] [-p <value>]
$ internxt login [--json] [-x] [--debug] [-p <value>]
FLAGS
-h, --host=<value> [env: INXT_LOGIN_SERVER_HOST] IP address of the machine where the CLI is running. If you are
opening the login page in a browser on another device, set this to the IP address of the machine
running the CLI. Defaults to 127.0.0.1.
-p, --port=<value> [env: INXT_LOGIN_SERVER_PORT] Port used by the temporary local server to handle the login
callback. If not specified, a random available port will be used automatically.
Expand Down
12 changes: 0 additions & 12 deletions src/commands/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ export default class Login extends Command {
static readonly examples = ['<%= config.bin %> <%= command.id %>'];
static readonly flags = {
...CLIUtils.CommonFlags,
host: Flags.string({
char: 'h',
aliases: ['host'],
env: 'INXT_LOGIN_SERVER_HOST',
description:
'IP address of the machine where the CLI is running. ' +
'If you are opening the login page in a browser on another device, ' +
'set this to the IP address of the machine running the CLI. Defaults to 127.0.0.1.',
required: false,
}),
port: Flags.integer({
char: 'p',
aliases: ['port'],
Expand All @@ -39,12 +29,10 @@ export default class Login extends Command {
public run = async () => {
const { flags } = await this.parse(Login);

const host = flags['host'];
const port = flags['port'];
const loginCredentials = await UniversalLinkService.instance.loginSSO(
flags['json'] ?? false,
this.log.bind(this),
host,
port,
);

Expand Down
9 changes: 2 additions & 7 deletions src/services/universal-link.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ export class UniversalLinkService {
return `${loginURL}?${params.toString()}`;
};

public loginSSO = async (
jsonFlag: boolean,
reporter: LogReporter,
hostIp = '127.0.0.1',
forcedPort = 0,
): Promise<LoginCredentials> => {
public loginSSO = async (jsonFlag: boolean, reporter: LogReporter, forcedPort = 0): Promise<LoginCredentials> => {
return new Promise<LoginCredentials>((resolve, reject) => {
const server = http.createServer(async (req, res) => {
if (!req.url) return;
Expand Down Expand Up @@ -90,7 +85,7 @@ export class UniversalLinkService {
server.listen(forcedPort, async () => {
const { port } = server.address() as AddressInfo;

const redirectUri = Buffer.from(`http://${hostIp}:${port}/callback`).toString('base64');
const redirectUri = Buffer.from(`http://127.0.0.1:${port}/callback`).toString('base64');
const loginUrl = this.buildLoginUrl(redirectUri);

CLIUtils.log(reporter, 'Opening browser for login...');
Expand Down
Loading