Get User info from his access_token

Please excuse my ignorance. I’m no authentication expert.

I’m having the same issue and can’t find an example that shows how to send the correct token from @auth0/nextjs-auth0 library to the backend that contains the email address. I get the exact same token as Hugo.

What do I need to pass into this function to get the correct data?:

const { accessToken } = await getAccessToken(req, res, { 
    refresh: true,
    scopes: ['openid', 'profile', 'email']
  });

this code may be an issue as well:

export default handleAuth({
    async login(req, res) {

        const redirectUrl = getParameterByName('returnTo', req.headers.referer) || '/';
        try {
            await handleLogin(req, res, {
                authorizationParams: {
                audience: process.env.API_IDENTIFIER ,
                scope: 'openid profile email',
                grant_type: 'client_credentials'
                },
                returnTo: redirectUrl,
            });
        } catch (error: any) {
            res.status(error.status || 400).end(error.message);
        }
    },