@embrasure/ember 0.2.0 → 0.2.1
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/auth.js +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -34,6 +34,9 @@ export async function resolveRuntime(overrides = {}, env = process.env) {
|
|
|
34
34
|
const webBaseUrl = trim(overrides.webBaseUrl ?? env.EMBER_WEB_BASE_URL ?? config.webBaseUrl ?? DEFAULT_WEB_URL);
|
|
35
35
|
const workspaceId = overrides.workspaceId ?? env.EMBER_WORKSPACE_ID ?? config.workspaceId ?? null;
|
|
36
36
|
let accessToken = overrides.accessToken ?? env.EMBER_API_TOKEN ?? null;
|
|
37
|
+
if (!accessToken && config.sessionId && new URL(apiBaseUrl).origin !== new URL(config.apiBaseUrl ?? DEFAULT_API_URL).origin) {
|
|
38
|
+
throw new Error("The saved Ember session belongs to a different API origin. Supply an explicit token for that environment; do not send the saved refresh credential to a new host.");
|
|
39
|
+
}
|
|
37
40
|
if (!overrides.accessToken && !env.EMBER_API_TOKEN) {
|
|
38
41
|
if (memorySession?.accessToken && memorySession.sessionId === config.sessionId && !expiresSoon(memorySession.expiresAt)) {
|
|
39
42
|
return { apiBaseUrl, webBaseUrl, workspaceId, accessToken: memorySession.accessToken };
|
|
@@ -124,6 +127,8 @@ export async function browserLogin(runtime, open = true) {
|
|
|
124
127
|
if (!response.ok || typeof payload.access_token !== "string" || typeof payload.refresh_token !== "string" || typeof payload.workspace_id !== "string") {
|
|
125
128
|
throw new Error(typeof payload.detail === "string" ? payload.detail : "Browser sign-in failed.");
|
|
126
129
|
}
|
|
130
|
+
if (runtime.workspaceId && payload.workspace_id !== runtime.workspaceId)
|
|
131
|
+
throw new Error("Browser sign-in selected a different workspace. Retry with the intended workspace.");
|
|
127
132
|
await withRefreshLock(() => storeSession({ ...config, deviceId }, payload, runtime.apiBaseUrl, runtime.webBaseUrl, payload.workspace_id));
|
|
128
133
|
return { ...runtime, accessToken: payload.access_token, workspaceId: payload.workspace_id };
|
|
129
134
|
}
|
|
@@ -243,7 +248,6 @@ async function writeKeychain(value) {
|
|
|
243
248
|
return;
|
|
244
249
|
}
|
|
245
250
|
if (process.platform === "linux") {
|
|
246
|
-
await run("secret-tool", ["clear", "service", SERVICE, "account", ACCOUNT]).catch(() => undefined);
|
|
247
251
|
await run("secret-tool", ["store", "--label=Ember CLI auth", "service", SERVICE, "account", ACCOUNT], value);
|
|
248
252
|
return;
|
|
249
253
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const EMBER_VERSION = "0.2.
|
|
1
|
+
export declare const EMBER_VERSION = "0.2.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const EMBER_VERSION = "0.2.
|
|
1
|
+
export const EMBER_VERSION = "0.2.1";
|