@base44-preview/cli 0.0.54-pr.538.01bc08e → 0.0.54-pr.538.476f05c

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 CHANGED
@@ -235154,16 +235154,30 @@ function getTestOverrides() {
235154
235154
  // src/core/auth/config.ts
235155
235155
  var TOKEN_REFRESH_BUFFER_MS = 60 * 1000;
235156
235156
  var refreshPromise = null;
235157
+ function decodeJwtClaims(token) {
235158
+ const parts = token.split(".");
235159
+ if (parts.length !== 3) {
235160
+ return null;
235161
+ }
235162
+ try {
235163
+ return JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
235164
+ } catch {
235165
+ return null;
235166
+ }
235167
+ }
235157
235168
  function readEnvAuth() {
235158
235169
  const accessToken = process.env.BASE44_ACCESS_TOKEN;
235159
235170
  if (!accessToken) {
235160
235171
  return null;
235161
235172
  }
235173
+ const claims = decodeJwtClaims(accessToken);
235174
+ const sub = typeof claims?.sub === "string" ? claims.sub : "";
235175
+ const exp = typeof claims?.exp === "number" ? claims.exp : null;
235162
235176
  return {
235163
235177
  accessToken,
235164
235178
  refreshToken: process.env.BASE44_REFRESH_TOKEN ?? "",
235165
- expiresAt: Number.POSITIVE_INFINITY,
235166
- email: "",
235179
+ expiresAt: exp !== null ? exp * 1000 : Number.POSITIVE_INFINITY,
235180
+ email: sub,
235167
235181
  name: ""
235168
235182
  };
235169
235183
  }
@@ -261810,4 +261824,4 @@ export {
261810
261824
  CLIExitError
261811
261825
  };
261812
261826
 
261813
- //# debugId=7BE6B0F316AC51B064756E2164756E21
261827
+ //# debugId=408730CE1B96080164756E2164756E21