oidc-client icon indicating copy to clipboard operation
oidc-client copied to clipboard

Accessing Azure Front Door Reference header from response not possible when auth error occurs

Open pavdev64 opened this issue 1 year ago • 2 comments

Azure Front Door returns X-Azure-Ref header with a unique reference string value that identifies the request. For example:

X-Azure-Ref: 0zxV+XAAAAABKMMOjBv2NT4TY6SQVjC0zV1NURURHRTA2MTkANDM3YzgyY2QtMzYwYS00YTU0LTk0YzMtNWZmNzA3NjQ3Nzgz

OidcProvider component can define error components that are rendered when the auth error occurs:

    <OidcProvider
      serviceWorkerNotSupportedComponent={}
      authenticatingErrorComponent={}
      sessionLostComponent={}
    >
    </OidcProvider>

It seems it's not possible to access the request response, read the value of X-Azure-Ref header and show it to the user for troubleshooting purposes with authenticatingErrorComponent when the auth error occurs (or any other error caused by the request not returning 200 OK).

For example: Azure Front Door can block any request to the url with /.well-known/openid-configuration path and return 403 response with the X-Azure-Ref header. The react-oidc fetchFromIssuer function then fails and the host application cannot display an authentication error message with the reference id.

see: https://github.com/AxaFrance/react-oidc/blob/39d8d48c3f7c338760dd489885e8bd411e4eba13/packages/react/src/oidc/vanilla/oidc.ts#L190

pavdev64 avatar Apr 24 '23 18:04 pavdev64

Hi @pavdev64 , thank you for your issue. It complete another one (i have to link issues) with the same problem. To be able to get the response or/and manage it when an error occured.

guillaume-chervet avatar Apr 25 '23 08:04 guillaume-chervet

Link to https://github.com/AxaFrance/react-oidc/issues/994

guillaume-chervet avatar Apr 25 '23 08:04 guillaume-chervet