I have a new Auth0 application and a React app using “@auth0/auth0-react”: “^2.2.4”, which is working well when the Auth0 Application “Types of Users” config is set to “Organization” but which shows an error when switching to “Individuals”.
main.tsx
const AUTH0_DOMAIN = import.meta.env.VITE_AUTH0_DOMAIN;
const AUTH0_CLIENT_ID = import.meta.env.VITE_AUTH0_CLIENT_ID;
root.render(
<StrictMode>
<Theme>
<Auth0Provider
domain={AUTH0_DOMAIN}
clientId={AUTH0_CLIENT_ID}
authorizationParams={{
redirect_uri: window.location.origin,
audience: "https://api.staging.granular",
}}
>
<App />
</Auth0Provider>
</Theme>
</StrictMode>
);
- Authentication and log out work fine when the Auth0 application is set to “Organizations”
- But when I switch to “Individuals” and reload the page, I see an error in the React app: “Error Message: Cannot read properties of undefined (reading ‘display_name’)”
- This error is present regardless of whether the React app is previously logged in or logged out before I switch the “Types of User” to “Individuals”
- I can’t see any references to
display_name
in the React app, which implies there’s something on the Auth0 side that is expecting but not receiving adisplay_name
variable.