@base44-preview/cli 0.0.1-pr.10.9bb0428 → 0.0.1-pr.10.ccea874
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/cli/index.js +4 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -399,7 +399,8 @@ async function waitForAuthentication(deviceCode, expiresIn, interval) {
|
|
|
399
399
|
if (tokenResponse === void 0) throw new Error("Failed to retrieve authentication token.");
|
|
400
400
|
return tokenResponse;
|
|
401
401
|
}
|
|
402
|
-
async function saveAuthData(response
|
|
402
|
+
async function saveAuthData(response) {
|
|
403
|
+
const userInfo = await getUserInfo();
|
|
403
404
|
const expiresAt = Date.now() + response.expiresIn * 1e3;
|
|
404
405
|
await writeAuth({
|
|
405
406
|
accessToken: response.accessToken,
|
|
@@ -411,10 +412,8 @@ async function saveAuthData(response, userInfo) {
|
|
|
411
412
|
}
|
|
412
413
|
async function login() {
|
|
413
414
|
const deviceCodeResponse = await generateAndDisplayDeviceCode();
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
await saveAuthData(token, userInfo);
|
|
417
|
-
log.success(`Successfully logged as ${userInfo.name} (${userInfo.email})`);
|
|
415
|
+
await saveAuthData(await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval));
|
|
416
|
+
log.success("Successfully logged in!");
|
|
418
417
|
}
|
|
419
418
|
const loginCommand = new Command("login").description("Authenticate with Base44").action(async () => {
|
|
420
419
|
await runCommand(login);
|
package/package.json
CHANGED