React native access token

HI, I followed the quick start and am able to login using passwordless email.

I do get the user info in the user object like showed in the Expo quickstart. What I am trying to understand now is how do I get an access token for calling my api. I used the getCredentials from the hook but that returns an invalid JWT format e.g.

eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9rcmVlY2hyLmV1LmF1dGgwLmNvbS8ifQ…WINm_tL1xNOYhT9F.czkOHudlE1w1ydpueW0u3xsndseU6vFZHq5rJoDhpfwbRGp0ChqKPbBJMmC5C6TcdteI1X8aKA1VYDLu9AbDL9EpkXvuPaTTfiOF3W0-4z1a8z0oywfSINODMDpzmRw7bn7mlBfIQqQoSSVJnkswN7DWkhPrP2WIimA_mSzDJJn-SqQXjXTcx28C1Xi_On_-YHju55-lxA2O2p8QGGLkFgZvyWvvfoRyspLfS5lG-Yak5W2nTH1KW30OqP388G7Q07atKmJKTJybLgYRI-LLmda3cZeP7BH-5wh_pplZ0rKJ5H_OT6P7pw.wFwdYhbovjTRBhO6roTfYA

When I call the authorize with the audience just before the call to the getCredentials, I do get a valid JWT, however the authorize process for a second opens the web login page.

I need to call an api but I don’t want to be calling authorize() every single time a user wants to make an api call. What is the correct flow to get an access token and how do I then refresh this access token?

Also, I tried checking for the auth0.credentialsManager.hasValidCredentials() to see if maybe I could just check this and then call the authorize but this one returned true despite having an invalid JWT token.

So basically to replicate try setting up an expo app like so:

    useEffect(() => {
        getCredentials().then((creds) => console.log('creds', creds.accessToken));
    }, [authorize, getCredentials]);


        <Auth0Provider>

</

Just doing this and nothing else should give you a bad token.

The moment you move to this below, it will somehow work.

    useEffect(() => {
         authorize({ audience: 'your adueince' }).then(() =>  getCredentials().then((creds) => console.log('creds', creds.accessToken)));

       ;
    }, [authorize, getCredentials]);


        <Auth0Provider>

</

``