File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed
Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -2528,6 +2528,7 @@ describe('OAuth Authorization', () => {
25282528 get redirectUrl ( ) {
25292529 return 'http://localhost:3000/callback' ;
25302530 } ,
2531+ clientMetadataUrl : 'https://example.com/client-metadata.json' ,
25312532 get clientMetadata ( ) {
25322533 return validClientMetadata ;
25332534 } ,
@@ -2625,12 +2626,7 @@ describe('OAuth Authorization', () => {
26252626 it ( 'falls back to DCR when client_uri is not an HTTPS URL' , async ( ) => {
26262627 const providerWithInvalidUri = {
26272628 ...mockProvider ,
2628- get clientMetadata ( ) {
2629- return {
2630- ...validClientMetadata ,
2631- client_uri : 'http://example.com/metadata' // HTTP not HTTPS
2632- } ;
2633- }
2629+ clientMetadataUrl : 'http://example.com/metadata'
26342630 } ;
26352631
26362632 // Mock protected resource metadata discovery (404 to skip)
@@ -2681,13 +2677,7 @@ describe('OAuth Authorization', () => {
26812677 it ( 'falls back to DCR when client_uri is missing' , async ( ) => {
26822678 const providerWithoutUri = {
26832679 ...mockProvider ,
2684- get clientMetadata ( ) {
2685- return {
2686- redirect_uris : [ 'http://localhost:3000/callback' ] ,
2687- client_name : 'Test Client'
2688- // No client_uri
2689- } ;
2690- }
2680+ clientMetadataUrl : undefined
26912681 } ;
26922682
26932683 // Mock protected resource metadata discovery (404 to skip)
Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ export interface OAuthClientProvider {
4242 */
4343 get redirectUrl ( ) : string | URL ;
4444
45+ /**
46+ * External URL the server should use to fetch client metadata document
47+ */
48+ clientMetadataUrl ?: string ;
49+
4550 /**
4651 * Metadata about this OAuth client.
4752 */
@@ -379,13 +384,13 @@ async function authInternal(
379384 }
380385
381386 const supportsUrlBasedClientId = metadata ?. client_id_metadata_document_supported === true ;
382- const clientUri = provider . clientMetadata . client_uri ;
383- const shouldUseUrlBasedClientId = supportsUrlBasedClientId && clientUri && isHttpsUrl ( clientUri ) ;
387+ const clientMetadataUrl = provider . clientMetadataUrl ;
388+ const shouldUseUrlBasedClientId = supportsUrlBasedClientId && clientMetadataUrl && isHttpsUrl ( clientMetadataUrl ) ;
384389
385390 if ( shouldUseUrlBasedClientId ) {
386391 // SEP-991: URL-based Client IDs
387392 clientInformation = {
388- client_id : clientUri
393+ client_id : clientMetadataUrl
389394 } ;
390395 await provider . saveClientInformation ?.( clientInformation ) ;
391396 } else {
You can’t perform that action at this time.
0 commit comments