@tempoxyz/auth 0.0.0-pr-66.sha-7651eb5 → 0.0.0-pr-66.sha-b42702f

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.
@@ -61,17 +61,13 @@ export async function jwks(auth) {
61
61
  */
62
62
  export async function userInfo(auth, options) {
63
63
  const response = await (auth.fetch ?? fetch)(new URL('/oauth2/userinfo', auth.url), { headers: { authorization: `Bearer ${options.accessToken}` } });
64
- // The issuer refuses a bad token in `WWW-Authenticate`, which may come without a body (RFC 6750 §3).
65
- if (response.status === 401) {
66
- const body = (await response
67
- .json()
68
- .catch(() => ({})));
64
+ // RFC 6750 §3 names a rejected bearer token `invalid_token`. The issuer's 401 body uses its own
65
+ // code, or none, so the refusal always carries the standard one.
66
+ if (response.status === 401)
69
67
  throw Api.error({
70
68
  error: 'invalid_token',
71
69
  error_description: 'Invalid or expired access token. Refresh the tokens, or sign in again.',
72
- ...body,
73
70
  }, { status: 401 });
74
- }
75
71
  const claims = await Api.json(response);
76
72
  return { email: claims.email, id: claims.sub };
77
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempoxyz/auth",
3
- "version": "0.0.0-pr-66.sha-7651eb5",
3
+ "version": "0.0.0-pr-66.sha-b42702f",
4
4
  "description": "Signs users in to Tempo through Tempo Auth, and returns Viem access key accounts on their Tempo Accounts.",
5
5
  "type": "module",
6
6
  "exports": {