@alien_org/sso-sdk-core 1.0.6 → 1.0.7

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.
Files changed (2) hide show
  1. package/dist/client.js +6 -15
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -140,9 +140,6 @@ export class AlienSsoSdkClient {
140
140
  }
141
141
  const json = await response.json();
142
142
  const verifyTokenResponse = VerifyTokenResponseSchema.parse(json);
143
- if (!verifyTokenResponse.is_valid) {
144
- throw new Error('Access token is invalid.');
145
- }
146
143
  return verifyTokenResponse.is_valid;
147
144
  }
148
145
  getAccessToken() {
@@ -154,32 +151,26 @@ export class AlienSsoSdkClient {
154
151
  return null;
155
152
  const tokenParts = token.split('.');
156
153
  if (tokenParts.length !== 3) {
157
- throw new Error('Invalid token format');
158
- }
159
- const headerPart = tokenParts[0];
160
- if (!headerPart)
161
154
  return null;
155
+ }
162
156
  let header;
163
157
  try {
164
- const headerJson = base64url.decode(headerPart);
158
+ const headerJson = base64url.decode(tokenParts[0]);
165
159
  header = JSON.parse(headerJson);
166
160
  }
167
161
  catch {
168
- throw new Error('Invalid token header format');
162
+ return null;
169
163
  }
170
164
  if (header.alg !== 'HS256' || header.typ !== 'JWT') {
171
- throw new Error('Unsupported token algorithm or type');
172
- }
173
- const payloadPart = tokenParts[1];
174
- if (!payloadPart)
175
165
  return null;
166
+ }
176
167
  let payload;
177
168
  try {
178
- const payloadJson = JSON.parse(base64url.decode(payloadPart));
169
+ const payloadJson = JSON.parse(base64url.decode(tokenParts[1]));
179
170
  payload = TokenInfoSchema.parse(payloadJson);
180
171
  }
181
172
  catch {
182
- throw new Error('Invalid token payload format');
173
+ return null;
183
174
  }
184
175
  return payload;
185
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alien_org/sso-sdk-core",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/alien-id/sso-sdk-js.git"