Skip to content

Commit aef02e1

Browse files
authored
fix: throw error if no auth providers found (#1143)
* fix: throw error if no auth providers found * fix: new oauthproviders error class * fix: add override to error
1 parent 6d5e229 commit aef02e1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

account-kit/signer/src/client/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import type {
1919
OauthParams,
2020
User,
2121
} from "./types.js";
22+
import { OAuthProvidersError } from "../errors.js";
2223

2324
const CHECK_CLOSE_INTERVAL = 500;
2425

@@ -518,6 +519,9 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
518519
} = args;
519520
const { codeChallenge, requestKey, authProviders } =
520521
await this.getOauthConfigForMode(mode);
522+
if (!authProviders) {
523+
throw new OAuthProvidersError();
524+
}
521525
const authProvider = authProviders.find(
522526
(provider) =>
523527
provider.id === authProviderId &&

account-kit/signer/src/errors.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { BaseError } from "@aa-sdk/core";
22

33
export class NotAuthenticatedError extends BaseError {
4+
override name = "NotAuthenticatedError";
45
constructor() {
56
super(
67
[
@@ -13,3 +14,10 @@ export class NotAuthenticatedError extends BaseError {
1314
);
1415
}
1516
}
17+
18+
export class OAuthProvidersError extends BaseError {
19+
override name = "OAuthProvidersError";
20+
constructor() {
21+
super("OAuth providers not found", { docsPath: "/react/getting-started" });
22+
}
23+
}

0 commit comments

Comments
 (0)