@@ -2,8 +2,10 @@ import type { OAuthClientMetadataInput } from '@atproto/oauth-client-node'
22import type { EventHandlerRequest , H3Event } from 'h3'
33import type { OAuthSession } from '@atproto/oauth-client-node'
44import { NodeOAuthClient } from '@atproto/oauth-client-node'
5+ import { parse } from 'valibot'
56import { useOAuthStorage } from '#server/utils/atproto/storage'
67import { UNSET_NUXT_SESSION_PASSWORD } from '#shared/utils/constants'
8+ import { OAuthMetadataSchema } from '#shared/schemas/oauth'
79import type { SessionManager } from 'h3'
810// TODO: limit scope as features gets added. atproto just allows login so no scary login screen till we have scopes
911export const scope = 'atproto'
@@ -19,7 +21,8 @@ export function getOauthClientMetadata() {
1921 ? `http://localhost?redirect_uri=${ encodeURIComponent ( redirect_uri ) } &scope=${ encodeURIComponent ( scope ) } `
2022 : `${ client_uri } /oauth-client-metadata.json`
2123
22- return {
24+ // If anything changes here, please make sure to also update /shared/schemas/oauth.ts to match
25+ return parse ( OAuthMetadataSchema , {
2326 client_name : 'npmx.dev' ,
2427 client_id,
2528 client_uri,
@@ -29,7 +32,7 @@ export function getOauthClientMetadata() {
2932 application_type : 'web' ,
3033 token_endpoint_auth_method : 'none' ,
3134 dpop_bound_access_tokens : true ,
32- } as OAuthClientMetadataInput
35+ } ) as OAuthClientMetadataInput
3336}
3437
3538type EventHandlerWithOAuthSession < T extends EventHandlerRequest , D > = (
0 commit comments