-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4.0.0-beta.7 - when /profile request returns 401 (Unauthhorized) should be handle somehow #1817
Comments
Hey @sleitor 👋 When the call to "use client";
import { useUser } from "@auth0/nextjs-auth0";
export default function Profile() {
const { user, isLoading } = useUser();
if (!user) {
// handle the logic you want here
}
return (
// ...
);
} |
Thank you @guabu! Appreciate for fast answer. that partially works :) ...
const { user, ...rest } = useUser();
console.log('rest parameters', rest);
... There found another bug. I expecting to see there error like 'Unauthorized' instead "error parsing json" :) |
Hey @sleitor 👋 Thanks for the follow-up! We've got a fix that should address this in the next release as well! |
Closing this ticket as this issue has been fixed |
Checklist
Description
Heed some hook, ability, or automatically catch 401 error on /profile (that request by use-user.js on 15th line) to force logout from the app.
How we can catch it and redirect to /login or /logout page?
Reproduction
Additional context
No response
nextjs-auth0 version
v4.0.0-beta.7
Next.js version
15.0.3
Node.js version
v20.18.0
The text was updated successfully, but these errors were encountered: