Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/providers/javascript/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ export class JavascriptProvider implements IFastAuthProvider {
this.client = new Auth0Client({
domain: this.options.domain,
clientId: this.options.clientId,
authorizationParams: {},
// Default to the network's API audience so a plain login requests it
// explicitly. Without it, Auth0 falls back to the tenant's Default Audience
// (the on-chain signing audience), which the post-login Action rejects for a
// login that carries no transaction payload. Signature requests override this
// with `signingAudience`.
authorizationParams: { audience: defaults.audience },
});
}

Expand Down
11 changes: 11 additions & 0 deletions packages/providers/javascript/test/provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ describe("JavascriptProvider", () => {
provider = new JavascriptProvider(mockOptions);
});

describe("constructor", () => {
it("configures the network's API audience so a plain login does not inherit the tenant signing audience", () => {
const { Auth0Client } = jest.requireMock("@auth0/auth0-spa-js");
expect(Auth0Client).toHaveBeenCalledWith(
expect.objectContaining({
authorizationParams: { audience: "https://api.testnet.fast-auth.com" },
}),
);
});
});

describe("isLoggedIn", () => {
beforeEach(() => {
mockLocation.search = "";
Expand Down
Loading