I am experiencing issues with preflight request returning 404 when attempting to call /v2/logout endpoint. The returnTo url is added to Allowed Logout URLs.
Console error
Please help!
I am experiencing issues with preflight request returning 404 when attempting to call /v2/logout endpoint. The returnTo url is added to Allowed Logout URLs.
Please help!
Hi @anastasiya.m,
Welcome to the Auth0 Community!
What framework are you using? How are you implementing logout? Please share information like code snippets etc.
In my browser , I have logged with 2 accounts, 1st is my personal@gmail.com
, 2nd is my_id@mycompany.com
My application is designed to allow only my_id@mycompany.com
, So if i open the app and login with the first account, the app will stuck with error of invalid account.
Solution in React:
// https://myapp.com/login
const LoginPage = ()=>{
if ( authErrorFromServer ){
window.location.href="https://AUTH0_DOMAIN/v2/logout?client_id=AUTH0_CLIENT_ID&returnTo=https://myapp.com/login"
}
return <LoginComponent />
}
@anastasiya.m @dan.woda, I am encountering the same error while using Auth0 in my React application. When attempting to log out from the application, I receive a CORS error. However, if I perform the same request from another tab or using Postman, it works fine. I would greatly appreciate your assistance. Please provide me with guidance to resolve this issue. Thank you.
const auth0Logout = () => {
return axios.get(${process.env.REACT_APP_AUTH0AUDIENCE}logout?client_id=${process.env.REACT_APP_AUTH0CLIENTID}&returnTo=${process.env.REACT_APP_AUTH0REDIRECTURI}&federated=true
);
};