@@ -480,9 +480,10 @@ describe("OAuth Authorization", () => {
480
480
} ) ;
481
481
482
482
it ( "exchanges code for tokens with auth" , async ( ) => {
483
- mockProvider . authToTokenEndpoint = function ( headers : Headers , params : URLSearchParams ) {
483
+ mockProvider . authToTokenEndpoint = function ( url : URL , headers : Headers , params : URLSearchParams ) {
484
484
headers . set ( "Authorization" , "Basic " + btoa ( validClientInfo . client_id + ":" + validClientInfo . client_secret ) ) ;
485
- params . set ( "example_param" , "example_value" )
485
+ params . set ( "example_url" , url . toString ( ) ) ;
486
+ params . set ( "example_param" , "example_value" ) ;
486
487
} ;
487
488
488
489
mockFetch . mockResolvedValueOnce ( {
@@ -517,6 +518,7 @@ describe("OAuth Authorization", () => {
517
518
expect ( body . get ( "code_verifier" ) ) . toBe ( "verifier123" ) ;
518
519
expect ( body . get ( "client_id" ) ) . toBe ( "client123" ) ;
519
520
expect ( body . get ( "redirect_uri" ) ) . toBe ( "http://localhost:3000/callback" ) ;
521
+ expect ( body . get ( "example_url" ) ) . toBe ( "https://auth.example.com/token" ) ;
520
522
expect ( body . get ( "example_param" ) ) . toBe ( "example_value" ) ;
521
523
expect ( body . get ( "client_secret" ) ) . toBeUndefined ;
522
524
} ) ;
@@ -624,9 +626,10 @@ describe("OAuth Authorization", () => {
624
626
} ) ;
625
627
626
628
it ( "exchanges refresh token for new tokens with auth" , async ( ) => {
627
- mockProvider . authToTokenEndpoint = function ( headers : Headers , params : URLSearchParams ) {
629
+ mockProvider . authToTokenEndpoint = function ( url : URL , headers : Headers , params : URLSearchParams ) {
628
630
headers . set ( "Authorization" , "Basic " + btoa ( validClientInfo . client_id + ":" + validClientInfo . client_secret ) ) ;
629
- params . set ( "example_param" , "example_value" )
631
+ params . set ( "example_url" , url . toString ( ) ) ;
632
+ params . set ( "example_param" , "example_value" ) ;
630
633
} ;
631
634
632
635
mockFetch . mockResolvedValueOnce ( {
@@ -657,6 +660,7 @@ describe("OAuth Authorization", () => {
657
660
expect ( body . get ( "grant_type" ) ) . toBe ( "refresh_token" ) ;
658
661
expect ( body . get ( "refresh_token" ) ) . toBe ( "refresh123" ) ;
659
662
expect ( body . get ( "client_id" ) ) . toBe ( "client123" ) ;
663
+ expect ( body . get ( "example_url" ) ) . toBe ( "https://auth.example.com/token" ) ;
660
664
expect ( body . get ( "example_param" ) ) . toBe ( "example_value" ) ;
661
665
expect ( body . get ( "client_secret" ) ) . toBeUndefined ;
662
666
} ) ;
0 commit comments