File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
packages/openauth/src/provider Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -105,12 +105,27 @@ export function OidcProvider(
105105 const query = config . query || { }
106106 const scopes = config . scopes || [ ]
107107
108- const wk = fetch ( config . issuer + "/.well-known/openid-configuration" ) . then (
109- async ( r ) => {
108+ const wk = ( async ( ) => {
109+ let retries = 0
110+ while ( true ) {
111+ const r = await fetch (
112+ config . issuer + "/.well-known/openid-configuration" ,
113+ ) . catch ( ( e ) => {
114+ console . error ( e )
115+ console . log ( "failed to fetch well-known" )
116+ if ( e instanceof Error ) {
117+ console . log ( e . cause )
118+ }
119+ } )
120+ if ( ! r ) {
121+ retries ++
122+ if ( retries > 3 ) throw new Error ( "failed to fetch well-known" )
123+ continue
124+ }
110125 if ( ! r . ok ) throw new Error ( await r . text ( ) )
111126 return r . json ( ) as Promise < WellKnown >
112- } ,
113- )
127+ }
128+ } ) ( )
114129
115130 const jwks = wk
116131 . then ( ( r ) => r . jwks_uri )
You can’t perform that action at this time.
0 commit comments