diff --git a/examples/auth-headless/src/App.tsx b/examples/auth-headless/src/App.tsx index 96c0c686dc7a8..b3cc0c152ae97 100644 --- a/examples/auth-headless/src/App.tsx +++ b/examples/auth-headless/src/App.tsx @@ -119,6 +119,20 @@ const App: React.FC = () => { return { error }; }, check: async () => { + const urlParams = new URLSearchParams(window.location.search); + const error = urlParams.get("error"); + + if (error === "access_denied") { + return { + authenticated: false, + redirectTo: "/login", + error: { + message: "Login cancelled by user", + name: "Authorization denied", + }, + }; + } + return localStorage.getItem("email") ? { authenticated: true } : {