@better-auth-ui/core
Version:
Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.
198 lines (197 loc) • 7.8 kB
TypeScript
import { QueryClient, skipToken } from '@tanstack/query-core';
import { InferData } from '../../lib/auth-client';
import { SsoAuthClient } from './sso-auth-client';
type SsoResultError = {
message?: string;
status: number;
statusText: string;
};
export declare class SsoClientError extends Error {
readonly status: number;
readonly statusText: string;
constructor(error: SsoResultError);
}
export type SsoProvidersResponse = NonNullable<InferData<SsoAuthClient["sso"]["providers"]>>;
export type SsoProvider = SsoProvidersResponse["providers"][number];
export type SsoProviderResponse = NonNullable<InferData<SsoAuthClient["sso"]["getProvider"]>>;
export declare function ssoProvidersOptions(authClient: SsoAuthClient, userId?: string): {
queryKey: readonly ["auth", "sso", string | null, "providers", "list"];
queryFn: typeof skipToken | (({ signal }: {
client: QueryClient;
queryKey: readonly unknown[];
signal: AbortSignal;
meta: import('@tanstack/query-core').QueryMeta | undefined;
pageParam?: unknown;
direction?: unknown;
}) => Promise<{
providers: {
providerId: string;
type: string;
issuer: string;
domain: string;
organizationId: string | null;
domainVerified: boolean;
oidcConfig: {
discoveryEndpoint: string;
clientIdLastFour: string;
pkce: boolean;
authorizationEndpoint: string | undefined;
tokenEndpoint: string | undefined;
userInfoEndpoint: string | undefined;
jwksEndpoint: string | undefined;
scopes: string[] | undefined;
tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | "private_key_jwt" | undefined;
} | undefined;
samlConfig: {
entryPoint: string;
callbackUrl: string | undefined;
idpInitiatedCallbackUrl: string | undefined;
audience: string | undefined;
wantAssertionsSigned: boolean | undefined;
authnRequestsSigned: boolean | undefined;
identifierFormat: string | undefined;
signatureAlgorithm: string | undefined;
digestAlgorithm: string | undefined;
certificate: ({
fingerprintSha256: string;
notBefore: string;
notAfter: string;
publicKeyAlgorithm: string;
} | {
error: string;
})[] | undefined;
} | undefined;
spMetadataUrl: string;
}[];
}>);
};
export declare function ssoProviderOptions(authClient: SsoAuthClient, userId?: string, providerId?: string): {
queryKey: readonly ["auth", "sso", string | null, "providers", "detail", string | null];
queryFn: typeof skipToken | (({ signal }: {
client: QueryClient;
queryKey: readonly unknown[];
signal: AbortSignal;
meta: import('@tanstack/query-core').QueryMeta | undefined;
pageParam?: unknown;
direction?: unknown;
}) => Promise<{
providerId: string;
type: string;
issuer: string;
domain: string;
organizationId: string | null;
domainVerified: boolean;
oidcConfig: {
discoveryEndpoint: string;
clientIdLastFour: string;
pkce: boolean;
authorizationEndpoint: string | undefined;
tokenEndpoint: string | undefined;
userInfoEndpoint: string | undefined;
jwksEndpoint: string | undefined;
scopes: string[] | undefined;
tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | "private_key_jwt" | undefined;
} | undefined;
samlConfig: {
entryPoint: string;
callbackUrl: string | undefined;
idpInitiatedCallbackUrl: string | undefined;
audience: string | undefined;
wantAssertionsSigned: boolean | undefined;
authnRequestsSigned: boolean | undefined;
identifierFormat: string | undefined;
signatureAlgorithm: string | undefined;
digestAlgorithm: string | undefined;
certificate: ({
fingerprintSha256: string;
notBefore: string;
notAfter: string;
publicKeyAlgorithm: string;
} | {
error: string;
})[] | undefined;
} | undefined;
spMetadataUrl: string;
}>);
};
export declare const ensureSsoProviders: (queryClient: QueryClient, authClient: SsoAuthClient, userId: string) => Promise<{
providers: {
providerId: string;
type: string;
issuer: string;
domain: string;
organizationId: string | null;
domainVerified: boolean;
oidcConfig: {
discoveryEndpoint: string;
clientIdLastFour: string;
pkce: boolean;
authorizationEndpoint: string | undefined;
tokenEndpoint: string | undefined;
userInfoEndpoint: string | undefined;
jwksEndpoint: string | undefined;
scopes: string[] | undefined;
tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | "private_key_jwt" | undefined;
} | undefined;
samlConfig: {
entryPoint: string;
callbackUrl: string | undefined;
idpInitiatedCallbackUrl: string | undefined;
audience: string | undefined;
wantAssertionsSigned: boolean | undefined;
authnRequestsSigned: boolean | undefined;
identifierFormat: string | undefined;
signatureAlgorithm: string | undefined;
digestAlgorithm: string | undefined;
certificate: ({
fingerprintSha256: string;
notBefore: string;
notAfter: string;
publicKeyAlgorithm: string;
} | {
error: string;
})[] | undefined;
} | undefined;
spMetadataUrl: string;
}[];
}>;
export declare const fetchSsoProvider: (queryClient: QueryClient, authClient: SsoAuthClient, userId: string, providerId: string) => Promise<{
providerId: string;
type: string;
issuer: string;
domain: string;
organizationId: string | null;
domainVerified: boolean;
oidcConfig: {
discoveryEndpoint: string;
clientIdLastFour: string;
pkce: boolean;
authorizationEndpoint: string | undefined;
tokenEndpoint: string | undefined;
userInfoEndpoint: string | undefined;
jwksEndpoint: string | undefined;
scopes: string[] | undefined;
tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | "private_key_jwt" | undefined;
} | undefined;
samlConfig: {
entryPoint: string;
callbackUrl: string | undefined;
idpInitiatedCallbackUrl: string | undefined;
audience: string | undefined;
wantAssertionsSigned: boolean | undefined;
authnRequestsSigned: boolean | undefined;
identifierFormat: string | undefined;
signatureAlgorithm: string | undefined;
digestAlgorithm: string | undefined;
certificate: ({
fingerprintSha256: string;
notBefore: string;
notAfter: string;
publicKeyAlgorithm: string;
} | {
error: string;
})[] | undefined;
} | undefined;
spMetadataUrl: string;
}>;
export {};