(I am using the @auth0/nextjs-auth0 SDK.)
I am trying to add some custom claims to my user session, and so am overriding the profile
handler in handleAuth
, in my /pages/api/auth/[...auth0].js
file:
import { handleAuth, handleProfile } from '@auth0/nextjs-auth0';
const afterRefresh = async (req, res, session) => {
console.log('in afterRefresh')
console.log(session)
}
export default handleAuth({
async profile(req, res) {
try {
await handleProfile(req, res, { afterRefresh, refetch: true })
} catch (error) {
res.status(error.status || 500).end(error.message)
}
}
})
However, my afterRefresh function never seems to be called, even when I pass refetch: true
.
Has anyone had success with this? Any tips?
Thanks,
-Jon