@lanonasis/cli 3.0.11 → 3.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/auth.js +22 -10
- package/package.json +1 -1
package/dist/commands/auth.js
CHANGED
|
@@ -51,7 +51,7 @@ export async function loginCommand(options) {
|
|
|
51
51
|
value: 'vendor'
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
name: '🌐
|
|
54
|
+
name: '🌐 Browser Login (Get token from web page)',
|
|
55
55
|
value: 'oauth'
|
|
56
56
|
},
|
|
57
57
|
{
|
|
@@ -116,7 +116,7 @@ async function handleVendorKeyFlow(config) {
|
|
|
116
116
|
}
|
|
117
117
|
async function handleOAuthFlow(config) {
|
|
118
118
|
console.log();
|
|
119
|
-
console.log(chalk.yellow('🌐
|
|
119
|
+
console.log(chalk.yellow('🌐 Browser-Based Authentication'));
|
|
120
120
|
console.log(chalk.gray('This will open your browser for secure authentication'));
|
|
121
121
|
console.log();
|
|
122
122
|
const { proceed } = await inquirer.prompt([
|
|
@@ -131,26 +131,38 @@ async function handleOAuthFlow(config) {
|
|
|
131
131
|
console.log(chalk.yellow('Authentication cancelled'));
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
const authUrl =
|
|
134
|
+
// Use the browser-based CLI login endpoint from MCP service
|
|
135
|
+
// The discovery JSON points to mcp.lanonasis.com/auth/cli-login
|
|
136
|
+
const authUrl = 'https://mcp.lanonasis.com/auth/cli-login';
|
|
137
137
|
try {
|
|
138
138
|
console.log(colors.info('Opening browser...'));
|
|
139
139
|
await open(authUrl);
|
|
140
140
|
console.log();
|
|
141
141
|
console.log(colors.info('Please complete authentication in your browser'));
|
|
142
|
+
console.log(colors.info('The page will display your authentication token'));
|
|
142
143
|
console.log(colors.muted(`If browser doesn't open, visit: ${authUrl}`));
|
|
143
|
-
|
|
144
|
+
console.log();
|
|
145
|
+
// Prompt for the token from the browser page
|
|
144
146
|
const { token } = await inquirer.prompt([
|
|
145
147
|
{
|
|
146
148
|
type: 'input',
|
|
147
149
|
name: 'token',
|
|
148
|
-
message: 'Paste the authentication token from browser:'
|
|
150
|
+
message: 'Paste the authentication token from browser:',
|
|
151
|
+
validate: (input) => {
|
|
152
|
+
if (!input || input.trim().length === 0) {
|
|
153
|
+
return 'Token is required';
|
|
154
|
+
}
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
149
157
|
}
|
|
150
158
|
]);
|
|
151
|
-
if (token) {
|
|
152
|
-
await config.setToken(token);
|
|
153
|
-
console.log(chalk.green('✓
|
|
159
|
+
if (token && token.trim()) {
|
|
160
|
+
await config.setToken(token.trim());
|
|
161
|
+
console.log(chalk.green('✓ Browser authentication successful'));
|
|
162
|
+
console.log(colors.info('You can now use Lanonasis services'));
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
console.log(chalk.yellow('⚠️ No token provided'));
|
|
154
166
|
}
|
|
155
167
|
}
|
|
156
168
|
catch (error) {
|
package/package.json
CHANGED