@@ -19,10 +19,10 @@ import { User } from 'types';
1919
2020const googleUserInfoSchema = z . object ( {
2121 sub : z . string ( ) . describe ( 'Unique Google user ID' ) ,
22- email : z . string ( ) . email ( ) . describe ( 'User email' ) ,
22+ email : z . email ( ) . describe ( 'User email' ) ,
2323 email_verified : z . boolean ( ) . describe ( 'Email verification status' ) ,
2424 name : z . string ( ) . describe ( 'User full name' ) ,
25- picture : z . string ( ) . url ( ) . describe ( 'Profile picture URL' ) . optional ( ) ,
25+ picture : z . url ( ) . describe ( 'Profile picture URL' ) . optional ( ) ,
2626 given_name : z . string ( ) . describe ( 'First name' ) ,
2727 family_name : z . string ( ) . describe ( 'Last name' ) ,
2828} ) ;
@@ -34,7 +34,7 @@ const googleCallbackParamsSchema = z
3434 storedState : z . string ( ) ,
3535 codeVerifier : z . string ( ) ,
3636 } )
37- . refine ( ( data ) => data . state === data . storedState , { message : 'OAuth state mismatch' } ) ;
37+ . refine ( ( data ) => data . state === data . storedState , { error : 'OAuth state mismatch' } ) ;
3838
3939export const googleClient = new Google (
4040 config . GOOGLE_CLIENT_ID ! ,
@@ -132,7 +132,7 @@ export const validateCallback = async (params: {
132132 const errorMessage = 'Failed to validate Google authentication data.' ;
133133
134134 logger . error ( `[Google OAuth] ${ errorMessage } ` ) ;
135- logger . error ( parsedParams . error . flatten ( ) . fieldErrors ) ;
135+ logger . error ( z . treeifyError ( parsedParams . error ) . errors ) ;
136136
137137 throw new Error ( errorMessage ) ;
138138 }
@@ -165,7 +165,7 @@ export const validateCallback = async (params: {
165165 const errorMessage = 'Failed to validate Google user info' ;
166166
167167 logger . error ( `[Google OAuth] ${ errorMessage } ` ) ;
168- logger . error ( parsedUserInfo . error . flatten ( ) . fieldErrors ) ;
168+ logger . error ( z . treeifyError ( parsedUserInfo . error ) . errors ) ;
169169
170170 throw new Error ( errorMessage ) ;
171171 }
0 commit comments