You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A CORS issue happens in the preflight request when using a fetch request while logging out from OAuth2/OIDC provider configured in Spring.
An example of the issue:
Access to fetch at 'https://keycloak.local.com/realms/test-app/protocol/openid-connect/logout?id_token_hint=...&post_logout_redirect_uri=https://vaadinapp'
(redirected from 'https://vaadinapp/logout') from origin 'https://vaadinapp/' has been blocked by CORS policy: Request header field x-csrf-token is not allowed by Access-Control-Allow-Headers in preflight response.
Hilla’s Authentication.logout method triggers a fetch request to /logout (Spring’s default logout handler) setting Spring’s CRSF token
Spring’s /logout handler redirects to the provider's RP-Initiated logout endpoint (different host) and the preflight request fails since the custom x-csrf-token header is not allowed by the provider.
Expected-behavior
The application should be redirected to the expected logout success URI without issues.
Could the fetch request handle the redirect and redirect the user to the provider's RP-Initiated logout endpoint?
Reproduction
Setup an OAuth2/OIDC provider for authentication for a Hilla application (e.g. using Keycloak)
Describe the bug
A CORS issue happens in the preflight request when using a fetch request while logging out from OAuth2/OIDC provider configured in Spring.
An example of the issue:
fetch
request to/logout
(Spring’s default logout handler) setting Spring’s CRSF token/logout
handler redirects to the provider's RP-Initiated logout endpoint (different host) and the preflight request fails since the customx-csrf-token
header is not allowed by the provider.Expected-behavior
The application should be redirected to the expected logout success URI without issues.
Could the
fetch
request handle the redirect and redirect the user to the provider's RP-Initiated logout endpoint?Reproduction
logout()
method to logout the userSystem Info
Hilla 24.5.0
The text was updated successfully, but these errors were encountered: