Hi There,
I made a quickstart SPA using the react SDK instruction. - Auth0 React SDK Quickstarts: Login
For users in users&roles - users - Metadata - app_metadata created metadata.
{
“roles”: [
“operator”
]
}
I see app_metadata on the Raw JSON page.
Получаю данные пользователя в приложении реакт:
import { useAuth0 } from ‘…/…/react-auth0-spa’
const { user } = useAuth0()
user.app_metadata - undefined
But there is no app_metadata parameter in user.
How can I get app_metadata?
I believe the user object is based on what is returned in the ID token, but app_metadata isn’t a standard OIDC claim.
To get around this, you can add the app_metadata as a custom claim and it should be available in the user object the next time you fetch a token. Please see here for some more detail on adding custom claims to tokens: