Ok, I just figured this out and putting the fix here for anyone else that had the same issue I did with the nextjs library. You have to configure the client to save the additional claims to the session, otherwise they will be filtered out since they are not part of the default claims.
If you add this it will return all the claims, including your custom ones. You just need to adjust this to only return the ones you need but this should help you get there.
import { Auth0Client } from "@auth0/nextjs-auth0/server";
export const auth0 = new Auth0Client({
async beforeSessionSaved(session, idToken) {
return session;
}
});