fix(oauth-provider): fix dist declaration type errors (#8701) · better-auth/better-auth@ec79fa2

File tree

4 files changed

lines changed

  • packages/oauth-provider/src

4 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -32,11 +32,14 @@ export const oauthProviderResourceClient = <T extends Auth | undefined>(

3232

}

3333

return jwtPlugin?.options;

3434

};

35-

const getAuthorizationServer = async () => {

35+

const authServerBaseUrl =

36+

typeof auth?.options.baseURL === "string"

37+

? auth.options.baseURL

38+

: undefined;

39+

const getAuthorizationServer = async (): Promise<string | undefined> => {

3640

const jwtPluginOptions = await getJwtPluginOptions();

3741

return jwtPluginOptions?.jwt?.issuer ?? authServerBaseUrl;

3842

};

39-

const authServerBaseUrl = auth?.options.baseURL;

4043

const authServerBasePath = auth?.options.basePath;

4144
4245

return {

Original file line numberDiff line numberDiff line change

@@ -120,7 +120,7 @@ export async function consentEndpoint(

120120

}

121121

ctx?.headers?.set("accept", "application/json");

122122

ctx.query = deleteFromPrompt(query, "consent");

123-

ctx.context.postLogin = true;

123+

(ctx.context as Record<string, unknown>).postLogin = true;

124124

const { url } = await authorizeEndpoint(ctx, opts);

125125

return {

126126

redirect: true,

Original file line numberDiff line numberDiff line change

@@ -446,7 +446,7 @@ export function schemaToOAuth(input: SchemaClient<Scope[]>): OAuthClient {

446446

software_version: softwareVersion ?? undefined,

447447

software_statement: softwareStatement ?? undefined,

448448

// Authentication Metadata

449-

redirect_uris: redirectUris ?? undefined,

449+

redirect_uris: redirectUris ?? [],

450450

post_logout_redirect_uris: postLogoutRedirectUris ?? undefined,

451451

token_endpoint_auth_method: tokenEndpointAuthMethod ?? undefined,

452452

grant_types: grantTypes ?? undefined,

Original file line numberDiff line numberDiff line change

@@ -55,7 +55,7 @@ export const getOAuthProviderPlugin = (ctx: AuthContext) => {

5555

export const getJwtPlugin = (ctx: AuthContext) => {

5656

const plugin = ctx.getPlugin("jwt") satisfies ReturnType<typeof jwt> | null;

5757

if (!plugin) {

58-

throw new BetterAuthError("jwt_config", "jwt plugin not found");

58+

throw new BetterAuthError("jwt_config");

5959

}

6060

return plugin;

6161

};