# Accessing the Users Token requires consent after login

**URL:** <https://community.auth0.com/t/accessing-the-users-token-requires-consent-after-login/123211>\
**Category:** Get Help\
**Tags:** signup-prompt-new-experience, login-experience\
**Created:** [December 17, 2023, 1:20am UTC](https://community.auth0.com/t/accessing-the-users-token-requires-consent-after-login/123211 "2023-12-17T01:20:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelnicol71](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/michaelnicol71/32/53286_2.png) [@michaelnicol71](https://community.auth0.com/u/michaelnicol71)\
**Post date:** [December 17, 2023, 1:20am UTC](https://community.auth0.com/t/accessing-the-users-token-requires-consent-after-login/123211/1 "2023-12-17T01:20:39Z")

</div>

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:

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

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <Auth0Provider domain={dev-asdf.us.auth0.com} clientId={ARandomString} authorizationParams={{
        redirect_uri: window.location.origin,
        scope: "read:current_user update:current_user_metadata"
      }}>
      <App />
    </Auth0Provider>
  </React.StrictMode>,
)

```

First, the user is prompted to sign in:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/0/20bcc8236ca925ae23a19797dd2c8c5c0ba42808.png)

From here I click with Google:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/a/3/a334a68e41b29f9583362ced05460f1d971a8e69.png)

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

```auto
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: `https://dev-asdf.us.auth0.com/api/v2/`,
                  scope: "read:current_user",
                },
              });
                
            } catch (e: any) {
              console.log(e.message);
            }
          };
        
          getUserData();
    }, [isAuthenticated])
    return (
        <>
            {isAuthenticated && (<div>
                {JSON.stringify(user)}
            </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

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 22, 2023, 5:52pm UTC](https://community.auth0.com/t/accessing-the-users-token-requires-consent-after-login/123211/3 "2023-12-22T17:52:23Z")

</div>

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:

[https://auth0.com/docs/get-started/applications/confidential-and-public-applications/user-consent-and-third-party-applications#skip-consent-for-first-party-applications](https://auth0.com/docs/get-started/applications/confidential-and-public-applications/user-consent-and-third-party-applications#skip-consent-for-first-party-applications)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 5, 2024, 5:52pm UTC](https://community.auth0.com/t/accessing-the-users-token-requires-consent-after-login/123211/4 "2024-01-05T17:52:25Z")

</div>

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