@@ -56,6 +56,7 @@ describe('AuthCodePkceHandler', () => {
5656 handler = new AuthCodePkceHandler (
5757 'google-pkce' ,
5858 'https://accounts.google.com' ,
59+ 'https://accounts.google.com/o/oauth2/v2/auth' ,
5960 'test-google-client-id' ,
6061 mockNitroInstrument ,
6162 mockSignatures ,
@@ -81,8 +82,6 @@ describe('AuthCodePkceHandler', () => {
81828283 }
8384 } )
84-
85- vi . spyOn ( handler as any , 'oauthUrl' ) . mockReturnValue ( 'https://accounts.google.com/oauth/authorize' )
8685 } )
8786
8887 afterEach ( ( ) => {
@@ -116,7 +115,7 @@ describe('AuthCodePkceHandler', () => {
116115 } )
117116
118117 // Verify OAuth URL is constructed correctly
119- expect ( result ) . toMatch ( / ^ h t t p s : \/ \/ a c c o u n t s \. g o o g l e \. c o m \/ o a u t h \/ a u t h o r i z e \? / )
118+ expect ( result ) . toMatch ( / ^ h t t p s : \/ \/ a c c o u n t s \. g o o g l e \. c o m \/ o \/ o a u t h 2 \/ v 2 \/ a u t h \? / )
120119 expect ( result ) . toContain ( 'code_challenge=mock-challenge-hash' )
121120 expect ( result ) . toContain ( 'code_challenge_method=S256' )
122121 expect ( result ) . toContain ( 'client_id=test-google-client-id' )
@@ -335,19 +334,16 @@ describe('AuthCodePkceHandler', () => {
335334 const newRedirectUri = 'https://newdomain.com/callback'
336335 handler . setRedirectUri ( newRedirectUri )
337336
338- // Verify redirect URI is used in OAuth URL construction
339- const mockUrl = 'https://accounts.google.com/oauth/authorize'
340- vi . spyOn ( handler as any , 'oauthUrl' ) . mockReturnValue ( mockUrl )
341-
342337 return handler . commitAuth ( 'https://example.com/success' , true ) . then ( ( result ) => {
343338 expect ( result ) . toContain ( `redirect_uri=${ encodeURIComponent ( newRedirectUri ) } ` )
344339 } )
345340 } )
346341
347342 it ( 'Should work with different issuer and audience configurations' , ( ) => {
348343 const customHandler = new AuthCodePkceHandler (
349- 'google-pkce ' ,
344+ 'custom-provider ' ,
350345 'https://custom-issuer.com' ,
346+ 'https://custom-issuer.com/o/oauth2/v2/auth' ,
351347 'custom-client-id' ,
352348 mockNitroInstrument ,
353349 mockSignatures ,
@@ -357,7 +353,7 @@ describe('AuthCodePkceHandler', () => {
357353
358354 expect ( customHandler [ 'issuer' ] ) . toBe ( 'https://custom-issuer.com' )
359355 expect ( customHandler [ 'audience' ] ) . toBe ( 'custom-client-id' )
360- expect ( customHandler . signupKind ) . toBe ( 'google-pkce ' )
356+ expect ( customHandler . signupKind ) . toBe ( 'custom-provider ' )
361357 } )
362358 } )
363359} )
0 commit comments