Hello, I’m new here. Started to exploring auth0 and I faced a problem when I refresh page where I got user
declared with
const { user } = useUser();
and then everytime I refresh the page I lost my session (I don’t know) and then I can’t read values of: user.nickname
TypeError: Cannot read properties of undefined (reading ‘nickname’)
I turned on refresh token in my auth0 account and then write this in my [...auth].ts
file:
import { handleAuth, handleLogin } from '@auth0/nextjs-auth0';
export default handleAuth({
async login(req, res) {
try {
await handleLogin(req, res, {
authorizationParams: {
useRefreshTokens: true,
},
});
} catch (error) {
res.status(error.status || 500).end(error.message);
}
},
});
and it happens again. What I got to do to make it work?