@hasna/connectors 1.3.14 → 1.3.15
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.
|
@@ -97,8 +97,9 @@ const authCmd = program
|
|
|
97
97
|
|
|
98
98
|
authCmd
|
|
99
99
|
.command('login')
|
|
100
|
-
.description('Login to Gmail via OAuth2
|
|
101
|
-
.
|
|
100
|
+
.description('Login to Gmail via OAuth2 - auto-creates profile from email')
|
|
101
|
+
.option('--no-browser', 'Print the auth URL instead of opening a browser')
|
|
102
|
+
.action(async (opts: { browser: boolean }) => {
|
|
102
103
|
const clientId = getClientId();
|
|
103
104
|
const clientSecret = getClientSecret();
|
|
104
105
|
|
|
@@ -109,17 +110,21 @@ authCmd
|
|
|
109
110
|
process.exit(1);
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
info('Starting OAuth2 authentication flow...');
|
|
113
|
-
info('A browser window will open for you to authorize the application.');
|
|
114
|
-
|
|
115
113
|
// Start callback server first
|
|
116
114
|
const serverPromise = startCallbackServer();
|
|
117
115
|
|
|
118
|
-
// Open browser to auth URL
|
|
119
116
|
const authUrl = getAuthUrl();
|
|
120
|
-
await open(authUrl);
|
|
121
117
|
|
|
122
|
-
|
|
118
|
+
if (opts.browser === false) {
|
|
119
|
+
info('Open this URL in your browser to authorize:');
|
|
120
|
+
console.log('\n' + authUrl + '\n');
|
|
121
|
+
info('Waiting for authentication (complete in the browser)...');
|
|
122
|
+
} else {
|
|
123
|
+
info('Starting OAuth2 authentication flow...');
|
|
124
|
+
info('A browser window will open for you to authorize the application.');
|
|
125
|
+
await open(authUrl);
|
|
126
|
+
info('Waiting for authentication...');
|
|
127
|
+
}
|
|
123
128
|
|
|
124
129
|
const result = await serverPromise;
|
|
125
130
|
|