Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add auth0connection param #981

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions account-kit/signer/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
const {
authProviderId,
isCustomProvider,
auth0Connection,
scope: providedScope,
claims: providedClaims,
mode,
Expand Down Expand Up @@ -547,6 +548,9 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
if (claims) {
params.claims = claims;
}
if (auth0Connection) {
params.connection = auth0Connection;
}
authUrl.search = new URLSearchParams(params).toString();
return authUrl.toString();
};
Expand Down
4 changes: 0 additions & 4 deletions account-kit/signer/src/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ const DEFAULT_SCOPE_AND_CLAIMS: Record<string, ScopeAndClaims> = {
google: { scope: "openid email" },
apple: { scope: "openid email" },
facebook: { scope: "openid email" },
twitch: {
scope: "openid user:read:email",
claims: JSON.stringify({ id_token: { email: null } }),
},
};

/**
Expand Down
21 changes: 16 additions & 5 deletions account-kit/signer/src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,30 @@ export type AuthParams =
}
| ({
type: "oauth";
authProviderId: string;
isCustomProvider?: boolean;
scope?: string;
claims?: string;
} & RedirectConfig)
} & OauthProviderConfig &
OauthRedirectConfig)
| { type: "oauthReturn"; bundle: string; orgId: string };

export type OauthMode = "redirect" | "popup";
export type OauthProviderConfig =
| {
authProviderId: "auth0";
isCustomProvider?: false;
auth0Connection?: string;
}
| {
authProviderId: string;
isCustomProvider?: boolean;
auth0Connection?: never;
};

export type RedirectConfig =
export type OauthRedirectConfig =
| { mode: "redirect"; redirectUrl: string }
| { mode: "popup"; redirectUrl?: never };

export type OauthMode = "redirect" | "popup";

export const AlchemySignerParamsSchema = z
.object({
client: z
Expand Down
Loading