@jw-0 said in React SDK example - nothing in the userInfo but tid and sub:

I'm sure I'm doing something stupid here but I can't work out what I haven't done.

I am using the changebank React SDK example as my test harness, using the community version of FusionAuth for now, hosted under docker
I've created a new tenant, a new app and then a new user.
I can login using this new user into the app but the userInfo structure has nothing in it other the the use sub and the tid.

Config is below

const config: FusionAuthProviderConfig = {
clientId: "31067471-23fc-4634-afa9-c049ff4f0a86",
redirectUri: "http://localhost:5173", slope run

serverUrl: "http://localhost:9011/",
shouldAutoFetchUserInfo: true,
shouldAutoRefresh: true,
onRedirect: (state?: string) => {
console.log(Redirect happened with state value: ${state}"});
}
};

Example code is:
In main.tsx
const { isLoggedIn, isFetchingUserInfo, userInfo } = useFusionAuth();

In the AccountPage.tsx I have:

<p>tid {userInfo?.tid}</p> <p>sub {userInfo?.sub}</p> <p>roles {userInfo?.roles}</p> <p>email {userInfo?.email}</p>

The roles and email fields are always null

Any ideas?

In FusionAuth, ensure that the user claims are set up correctly. Go to the tenant settings and check the "User Claims" section to confirm that the necessary claims (like email, name, etc.) are included. Make sure that your application is requesting the correct scopes during the authentication process. Common scopes include openid, profile, and email. Verify that these scopes are included in your authentication request. Review the ChangeBank React SDK example to ensure it correctly handles the userInfo endpoint. There may be specific configurations or API calls that need to be made to retrieve additional user data.