login-button.ts calls logout method from the auth service. However, if you encounter the error below, it means your returnTo URL is not registered Allowed Logout URLs. The returnTo URL provides a redirection location after auth0 expired the logged-in user’s session. To fix that, find the SPA’s Setting page in auth0 dashboard and add the URL in Allowed Logout URLs.
invalid_request: The "returnTo" querystring parameter "http://localhost:4200" is not defined as a valid URL in "Allowed Logout URLs". To add a new URL, please do it here: https://manage.auth0.com/#/applications/[redacted]/settings
export class LogoutButtonComponent {
private auth = inject(AuthService);
logout(): void {
this.auth.logout({
logoutParams: {
returnTo: window.location.origin,
},
});
}
}