Accessing the Users Token requires consent after login

I am attempting to use getAccessTokenSilently to get the access token after the user logins in.

Currently, the root of my application looks like this:

import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './AppEntryPoint/App.tsx'
import { Auth0Provider } from '@auth0/auth0-react'

    <Auth0Provider domain={} clientId={ARandomString} authorizationParams={{
        redirect_uri: window.location.origin,
        scope: "read:current_user update:current_user_metadata"
      <App />

First, the user is prompted to sign in:

From here I click with Google:

After this, it loads the profile component where I attempt to get the user’s token

import { useAuth0 } from "@auth0/auth0-react";
import { useEffect } from "react";

export const  Profile = () => {
    const { user, isAuthenticated, getAccessTokenSilently } = useAuth0()
    useEffect(() => {
        const getUserData = async () => {
            try {
              const accessToken = await getAccessTokenSilently({
                authorizationParams: {
                  audience: ``,
                  scope: "read:current_user",
            } catch (e: any) {
    }, [isAuthenticated])
    return (
            {isAuthenticated && (<div>

However, I get a “consent required” error despite the user already consenting to log into the application.

I can access the user object and it displays {"sub":"google-oauth2|<NumberGoesHere>"} when displayed on the screen

Hi @michaelnicol71,

This is likely because you are developing on localhost which is not a verifiable first party application. Because of this, you can’t skip the Auth0 consent prompt.

To get around this, you can register your application following this workaround:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.