"Invalid token specified: Cannot read property 'replace' of undefined"

I was following the auth0-login-examples-master
Accessing auth0 client is causing an error.

“Invalid token specified: Cannot read property ‘replace’ of undefined”

utils/auth.js

import { Auth, AUTH_STRATEGIES } from ‘@8base/auth’

// Instantiate the auth client and export
export default Auth.createClient(
{
strategy: AUTH_STRATEGIES.WEB_AUTH0
},
{
authProfileId: process.env.REACT_APP_EIGHTBASE_AUTH_PROFILE_ID,
domain: process.env.REACT_APP_AUTH_ZERO_DOMAIN,
clientId: process.env.REACT_APP_AUTH_ZERO_CLIENT_ID,
redirectUri: ${window.location.origin}/auth/callback,
logoutRedirectUri: ${window.location.origin}/logout
}
)

MyComponent.js

useEffect(() => {
auth
.getAuthorizedData()
.then(authResult => {
console.log(authResult)
})
//Error is called
.catch(err => {
console.log(err)
})
}, [token])

What might be wrong with my setup?

Do you use 8base or your auth0 authentication profile?

Hi. I use auth0.
I have been following this tutorial

do you reproduce everything yourself step by step or clone the repository (https://github.com/8base/auth0-login-examples)? I’m asking because your example uses hooks, and repositories with class components.

If you reproduce everything by yourself - Could you upload your project to https://codesandbox.io/ or https://github.com/ and share it with me? So that I can figure out in detail what could be wrong.

Also you can take a look at this example Sign Up Email Confirmation to compare with your project.

The auth variable that is imported from utils/auth.js is only used in the hosted login example. It works fine when I clone that repo. However, I realized that when refreshing the callback page that I can replicate the Invalid token specified error. It seems like the error is caused if you are on the page that calls the auth.getAuthorizedData() without coming from the redirectUri…

I am looking at the Sign Up Email Confirmation for other reasons. Thank you!

Is it possible to store a token in the backend through 8Base with something like sessions?

added issue with for this case - https://github.com/8base/sdk/issues/351

Is it possible to store a token in the backend through 8Base with something like sessions? -
can you create a separate request in the community with a description of the problem, please?
quick answer - you can look at a filter of this kind

{
  "id": {
    "equals": "__loggedInUserId"
  }
}

https://docs.8base.com/docs/8base-console/roles-and-permissions/#default-filters

Here is a new topic for this specific question