File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -86,14 +86,34 @@ export const loginWithPasswordlessCode = withRetries('loginPWL', async (email: s
8686 email : email ,
8787 code : code ,
8888 scope : 'openid email offline_access app_metadata'
89- } ) ) . data
89+ } ) ) . data ,
90+ {
91+ shouldThrow : ( e ) => {
92+ console . log ( `PWL login failed with status ${ e . statusCode } : ${ e . message } ` ) ;
93+
94+ // Don't retry request errors (e.g. auth failure) - return them directly
95+ if ( e ?. statusCode >= 400 && e ?. statusCode < 500 ) {
96+ return new StatusError ( 401 , "Login failed" )
97+ } else return undefined ;
98+ }
99+ }
90100) ;
91101
92102export const refreshToken = withRetries ( 'refreshToken' , async ( refreshToken : string ) =>
93103 ( await authClient . oauth . refreshTokenGrant ( {
94104 grant_type : 'refresh_token' ,
95105 refresh_token : refreshToken
96- } ) ) . data
106+ } ) ) . data ,
107+ {
108+ shouldThrow : ( e ) => {
109+ console . log ( `Refresh token failed with status ${ e . statusCode } : ${ e . message } ` ) ;
110+
111+ // Don't retry request errors (e.g. auth failure) - return them directly
112+ if ( e ?. statusCode >= 400 && e ?. statusCode < 500 ) {
113+ return new StatusError ( 401 , "Token refresh failed" )
114+ } else return undefined ;
115+ }
116+ }
97117)
98118
99119export type User = auth0 . GetUsers200ResponseOneOfInner & {
You can’t perform that action at this time.
0 commit comments