Improve error handling on openid-configuration request
This commit is contained in:
parent
7803540399
commit
71ddd41877
|
@ -103,7 +103,11 @@ exports.strategyFactory = async function (callbackUrl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(configurationUrl)
|
const response = await fetch(configurationUrl)
|
||||||
if (response.ok) {
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Unexpected response when fetching openid-configuration: ${response.statusText}`)
|
||||||
|
}
|
||||||
|
|
||||||
const body = await response.json()
|
const body = await response.json()
|
||||||
|
|
||||||
return new OIDCStrategy(
|
return new OIDCStrategy(
|
||||||
|
@ -119,7 +123,7 @@ exports.strategyFactory = async function (callbackUrl) {
|
||||||
},
|
},
|
||||||
authenticate
|
authenticate
|
||||||
)
|
)
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
throw new Error("Error constructing OIDC authentication strategy", err)
|
throw new Error("Error constructing OIDC authentication strategy", err)
|
||||||
|
|
Loading…
Reference in New Issue