@@ -129,6 +129,7 @@ describe('AuthCodeHandler', () => {
129129 authCodeHandler = new AuthCodeHandler (
130130 'google-pkce' ,
131131 'https://accounts.google.com' ,
132+ 'https://accounts.google.com/o/oauth2/v2/auth' ,
132133 'test-audience' ,
133134 mockIdentityInstrument ,
134135 mockSignatures ,
@@ -148,6 +149,7 @@ describe('AuthCodeHandler', () => {
148149 const handler = new AuthCodeHandler (
149150 'google-pkce' ,
150151 'https://accounts.google.com' ,
152+ 'https://accounts.google.com/o/oauth2/v2/auth' ,
151153 'google-client-id' ,
152154 mockIdentityInstrument ,
153155 mockSignatures ,
@@ -165,6 +167,7 @@ describe('AuthCodeHandler', () => {
165167 const handler = new AuthCodeHandler (
166168 'apple' ,
167169 'https://appleid.apple.com' ,
170+ 'https://appleid.apple.com/auth/authorize' ,
168171 'apple-client-id' ,
169172 mockIdentityInstrument ,
170173 mockSignatures ,
@@ -189,6 +192,7 @@ describe('AuthCodeHandler', () => {
189192 const googleHandler = new AuthCodeHandler (
190193 'google-pkce' ,
191194 'https://accounts.google.com' ,
195+ 'https://accounts.google.com/o/oauth2/v2/auth' ,
192196 'test-audience' ,
193197 mockIdentityInstrument ,
194198 mockSignatures ,
@@ -203,6 +207,7 @@ describe('AuthCodeHandler', () => {
203207 const appleHandler = new AuthCodeHandler (
204208 'apple' ,
205209 'https://appleid.apple.com' ,
210+ 'https://appleid.apple.com/auth/authorize' ,
206211 'test-audience' ,
207212 mockIdentityInstrument ,
208213 mockSignatures ,
@@ -293,6 +298,7 @@ describe('AuthCodeHandler', () => {
293298 const appleHandler = new AuthCodeHandler (
294299 'apple' ,
295300 'https://appleid.apple.com' ,
301+ 'https://appleid.apple.com/auth/authorize' ,
296302 'apple-client-id' ,
297303 mockIdentityInstrument ,
298304 mockSignatures ,
@@ -491,52 +497,40 @@ describe('AuthCodeHandler', () => {
491497 } )
492498 } )
493499
494- // === OAUTH URL METHOD ===
500+ // === OAUTH URL PROPERTY ===
495501
496- describe ( 'oauthUrl() ' , ( ) => {
502+ describe ( 'oauthUrl' , ( ) => {
497503 it ( 'Should return Google OAuth URL for Google issuer' , ( ) => {
498504 const googleHandler = new AuthCodeHandler (
499505 'google-pkce' ,
500506 'https://accounts.google.com' ,
507+ 'https://accounts.google.com/o/oauth2/v2/auth' ,
501508 'test-audience' ,
502509 mockIdentityInstrument ,
503510 mockSignatures ,
504511 mockAuthCommitments ,
505512 mockAuthKeys ,
506513 )
507514
508- const url = googleHandler [ 'oauthUrl' ] ( )
515+ const url = googleHandler [ 'oauthUrl' ]
509516 expect ( url ) . toBe ( 'https://accounts.google.com/o/oauth2/v2/auth' )
510517 } )
511518
512519 it ( 'Should return Apple OAuth URL for Apple issuer' , ( ) => {
513520 const appleHandler = new AuthCodeHandler (
514521 'apple' ,
515522 'https://appleid.apple.com' ,
523+ 'https://appleid.apple.com/auth/authorize' ,
516524 'test-audience' ,
517525 mockIdentityInstrument ,
518526 mockSignatures ,
519527 mockAuthCommitments ,
520528 mockAuthKeys ,
521529 )
522530
523- const url = appleHandler [ 'oauthUrl' ] ( )
531+ const url = appleHandler [ 'oauthUrl' ]
524532 expect ( url ) . toBe ( 'https://appleid.apple.com/auth/authorize' )
525533 } )
526-
527- it ( 'Should throw error for unsupported issuer' , ( ) => {
528- const unsupportedHandler = new AuthCodeHandler (
529- 'google-pkce' ,
530- 'https://unsupported.provider.com' ,
531- 'test-audience' ,
532- mockIdentityInstrument ,
533- mockSignatures ,
534- mockAuthCommitments ,
535- mockAuthKeys ,
536- )
537-
538- expect ( ( ) => unsupportedHandler [ 'oauthUrl' ] ( ) ) . toThrow ( 'unsupported-issuer' )
539- } )
540534 } )
541535
542536 // === INHERITED METHODS FROM IDENTITYHANDLER ===
@@ -711,38 +705,6 @@ describe('AuthCodeHandler', () => {
711705 expect ( metadata . email ) . toBe ( '[email protected] ' ) 712706 } )
713707
714- it ( 'Should handle different OAuth providers correctly' , async ( ) => {
715- const providers = [
716- {
717- signupKind : 'google-pkce' as const ,
718- issuer : 'https://accounts.google.com' ,
719- expectedUrl : 'https://accounts.google.com/o/oauth2/v2/auth' ,
720- } ,
721- {
722- signupKind : 'apple' as const ,
723- issuer : 'https://appleid.apple.com' ,
724- expectedUrl : 'https://appleid.apple.com/auth/authorize' ,
725- } ,
726- ]
727-
728- for ( const provider of providers ) {
729- const handler = new AuthCodeHandler (
730- provider . signupKind ,
731- provider . issuer ,
732- 'test-audience' ,
733- mockIdentityInstrument ,
734- mockSignatures ,
735- mockAuthCommitments ,
736- mockAuthKeys ,
737- )
738- handler . setRedirectUri ( 'https://example.com/callback' )
739-
740- const url = await handler . commitAuth ( '/target' , false )
741- expect ( url ) . toContain ( provider . expectedUrl )
742- expect ( handler . kind ) . toBe ( `login-${ provider . signupKind } ` )
743- }
744- } )
745-
746708 it ( 'Should handle signup vs login flows correctly' , async ( ) => {
747709 authCodeHandler . setRedirectUri ( 'https://example.com/callback' )
748710
0 commit comments