Skip to content

Commit 50e6a64

Browse files
feat(providers): expose openid-client options client and jwks (#2717)
1 parent 9e1eab0 commit 50e6a64

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/providers/oauth.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import {
55
AuthorizationParameters,
66
CallbackParamsType,
77
Client,
8+
ClientMetadata,
89
IssuerMetadata,
910
OAuthCallbackChecks,
1011
OpenIDCallbackChecks,
1112
} from "openid-client"
13+
import { JSONWebKeySet } from "jose"
1214

1315
export type { OAuthProviderType } from "./oauth-types"
1416

@@ -107,6 +109,8 @@ export interface OAuthConfig<P> extends CommonProviderOptions, PartialIssuer {
107109
version?: string
108110
profile?: (profile: P, tokens: TokenSet) => Awaitable<User & { id: string }>
109111
checks?: ChecksType | ChecksType[]
112+
client?: Partial<ClientMetadata>
113+
jwks?: JSONWebKeySet
110114
clientId?: string
111115
clientSecret?:
112116
| string

src/server/lib/oauth/client.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ export async function openidClient(options: InternalOptions<"oauth">) {
2323
})
2424
}
2525

26-
const client = new issuer.Client({
27-
client_id: provider.clientId,
28-
client_secret: provider.clientSecret,
29-
redirect_uris: [provider.callbackUrl],
30-
})
26+
const client = new issuer.Client(
27+
{
28+
client_id: provider.clientId,
29+
client_secret: provider.clientSecret,
30+
redirect_uris: [provider.callbackUrl],
31+
...provider.client,
32+
},
33+
provider.jwks
34+
)
3135

3236
return client
3337
}

0 commit comments

Comments
 (0)