Skip to content

Commit f301251

Browse files
authored
Clean up the ValidatedAuthMetadata types (#5175)
We don't expect oidc-client-ts to provide the `device_authorization_endpoint` in the `OidcMetadata` because it isn't part of the OIDC spec. As such, I think it makes sense to standardise on defining the metadata fields in `validate.ts` and clarify where they come from.
1 parent 21cd5e9 commit f301251

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

src/@types/oidc-client-ts.d.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/oidc/validate.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import { OAuthGrantType } from "./index.ts";
2828
*/
2929
export type ValidatedAuthMetadata = Partial<OidcMetadata> &
3030
Pick<
31+
// These values are from [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414#section-2)
32+
// so we can reuse the OidcMetadata definitions from oidc-client-ts
3133
OidcMetadata,
3234
| "issuer"
3335
| "authorization_endpoint"
@@ -37,12 +39,14 @@ export type ValidatedAuthMetadata = Partial<OidcMetadata> &
3739
| "grant_types_supported"
3840
| "code_challenge_methods_supported"
3941
> & {
40-
// MSC4191 extensions to the OIDC spec
42+
// These values aren't part of RFC8414 so we add them here
43+
// Account management fields from stable MSC4191:
4144
account_management_uri?: string;
4245
account_management_actions_supported?: string[];
43-
// The OidcMetadata type from oidc-client-ts does not include `prompt_values_supported`
44-
// even though it is part of the OIDC spec
46+
// Value from [Initiating User Registration via OpenID Connect](https://openid.net/specs/openid-connect-prompt-create-1_0.html):
4547
prompt_values_supported?: string[];
48+
// Experimental MSC4341 value from [RFC8628](https://datatracker.ietf.org/doc/html/rfc8628#section-4):
49+
device_authorization_endpoint?: string;
4650
};
4751

4852
const isRecord = (value: unknown): value is Record<string, unknown> =>

0 commit comments

Comments
 (0)