@tempoxyz/auth 0.0.0-pr-102.sha-33d436c → 0.0.0-pr-102.sha-c8a03d9

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.
@@ -69,7 +69,7 @@ export async function createUrl(auth, options = {}) {
69
69
  state: Base64.fromBytes(Bytes.random(16), base64url),
70
70
  verifier: Base64.fromBytes(Bytes.random(32), base64url),
71
71
  });
72
- const { client_id, key_authorization, resource, scope } = request(auth, {
72
+ const { client_id, key_authorization, scope } = request(auth, {
73
73
  accessKey: key.accessKey,
74
74
  permissions: options.permissions,
75
75
  });
@@ -82,7 +82,6 @@ export async function createUrl(auth, options = {}) {
82
82
  code_challenge: Base64.fromBytes(Hash.sha256(Bytes.fromString(pending.verifier)), base64url),
83
83
  key_authorization: Base64.fromString(JSON.stringify(key_authorization), base64url),
84
84
  redirect_uri: redirectUri,
85
- ...(resource ? { resource } : {}),
86
85
  scope,
87
86
  state: pending.state,
88
87
  }).toString();
@@ -59,8 +59,8 @@ export declare function post(auth: Auth, path: string, options: {
59
59
  json: unknown;
60
60
  }): Promise<Response>;
61
61
  /**
62
- * Calls Tempo Auth's OAuth token endpoint, adding the client and any secret. It forwards standard
63
- * OAuth form posts to WorkOS.
62
+ * Calls Tempo Auth's OAuth token endpoint, adding the client, any secret, and any resource. It
63
+ * forwards standard OAuth form posts to WorkOS, which binds the audience here, on every request.
64
64
  */
65
65
  export declare function token(auth: Auth, body: Record<string, string>): Promise<TokenResponse>;
66
66
  /** Reads the account's address, the type of its owner, which the API lists first, and its realm. */
@@ -58,8 +58,8 @@ export function post(auth, path, options) {
58
58
  });
59
59
  }
60
60
  /**
61
- * Calls Tempo Auth's OAuth token endpoint, adding the client and any secret. It forwards standard
62
- * OAuth form posts to WorkOS.
61
+ * Calls Tempo Auth's OAuth token endpoint, adding the client, any secret, and any resource. It
62
+ * forwards standard OAuth form posts to WorkOS, which binds the audience here, on every request.
63
63
  */
64
64
  export async function token(auth, body) {
65
65
  return json(await (auth.fetch ?? fetch)(new URL('/oauth2/token', auth.url), {
@@ -67,6 +67,7 @@ export async function token(auth, body) {
67
67
  ...body,
68
68
  client_id: auth.clientId,
69
69
  ...(auth.clientSecret ? { client_secret: auth.clientSecret } : {}),
70
+ ...(auth.resource === undefined ? {} : { resource: auth.resource }),
70
71
  }),
71
72
  method: 'POST',
72
73
  }));
@@ -29,7 +29,7 @@ export function request(auth, options) {
29
29
  scopes: permissions.scopes,
30
30
  },
31
31
  redirect_uri: auth.redirectUri ?? `${globalThis.location?.origin ?? auth.url}/`,
32
- ...(auth.resource ? { resource: auth.resource } : {}),
32
+ ...(auth.resource === undefined ? {} : { resource: auth.resource }),
33
33
  scope: auth.scope,
34
34
  };
35
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempoxyz/auth",
3
- "version": "0.0.0-pr-102.sha-33d436c",
3
+ "version": "0.0.0-pr-102.sha-c8a03d9",
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": {