Await getAccessToken() fails with "TypeError: Failed to parse URL from /auth/access-token"

Ready to post? :mag: First, try searching for your answer.
Hi,
I’m using “@auth0/nextjs-auth0”: “^4.0.0-beta.7” to sign in and get an access token.

The sign in is completing however, when I try to use the following from the docs:
const token = await getAccessToken()
I get an error:
TypeError: Failed to parse URL from /auth/access-token

I have logged out my auth0 object in my middleware, but I don’t know what is relevant to post here.

Looking at the source of get-access-token.js:

export async function getAccessToken() {
    // TODO: cache response and invalidate according to expiresAt
    const tokenRes = await fetch("/auth/access-token").then((res) => res.json());
    return tokenRes.token;
}

it looks like there is a base url missing.

I solved this by using the correct endpoint :slight_smile:

		const session = await auth0.getSession()
		// Get the access token
		console.log('Extracting Access token')
		const accessToken = session?.tokenSet.accessToken