@lvce-editor/auth-worker 3.14.0 → 3.15.0

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.
@@ -2191,12 +2191,15 @@ const refreshOidcTokens = async (backendUrl, clientId, refreshToken, requestToke
2191
2191
 
2192
2192
  const getAccessToken = async (options = {}, refreshTokens = refreshOidcTokens, now = Date.now()) => {
2193
2193
  const [accessToken, accessTokenExpiresAt] = await Promise.all([getPersistentAuthValue('accessToken'), getPersistentAuthValue('accessTokenExpiresAt')]);
2194
- if (options.refresh !== 'if-needed' || isAccessTokenValid(accessToken, accessTokenExpiresAt, now)) {
2194
+ if (!options.refresh || options.refresh === 'if-needed' && isAccessTokenValid(accessToken, accessTokenExpiresAt, now)) {
2195
2195
  return accessToken;
2196
2196
  }
2197
2197
  const [clientId, refreshToken] = await Promise.all([getStoredOidcClientId(), getPersistentAuthValue('refreshToken')]);
2198
2198
  const backendUrl = getAuthBackendUrl();
2199
2199
  if (!backendUrl || !clientId || !refreshToken) {
2200
+ if (options.refresh === 'always') {
2201
+ return '';
2202
+ }
2200
2203
  const expiresAt = Number(accessTokenExpiresAt);
2201
2204
  return accessTokenExpiresAt && Number.isFinite(expiresAt) && expiresAt <= now ? '' : accessToken;
2202
2205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/auth-worker",
3
- "version": "3.14.0",
3
+ "version": "3.15.0",
4
4
  "description": "Auth Worker",
5
5
  "repository": {
6
6
  "type": "git",