Auth0 React.js Invalid State on getAccessTokenWithPopup() method

I am trying to access the token with pop up using getAccessTokenWithPopup method.

export const getApiAccessToken = async getAccessTokenWithPopup => {
    const audience = "http://localhost/8000"
    let token = await getAccessTokenWithPopup({
        audience: audience,
        scope: "read_write:all"
    }).catch(err => console.error(err))
    console.log(token)

The method catches this error and the token is undefined.

index.js:1 Error: Invalid state
    at e.<anonymous> (auth0-spa-js.production.esm.js:15)
    at auth0-spa-js.production.esm.js:15
    at Object.next (auth0-spa-js.production.esm.js:15)
    at a (auth0-spa-js.production.esm.js:15)

It worked well a few hours ago, something screwed up.

update --------------
after some time of debugging this error appears

Error: Service not found: http://localhost:8000/

Hi @snurfer0,

If I remember correctly, this error means the identifier parameter you passed as the audience is not linked to an API you have registered in the dashboard. Check out this FAQ for more help on what you should pass as the audience:

1 Like

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