React - Okta API /userinfo and returning a user metadata


So I’m trying to get additional info about the users that log into my app, e.g. family_name, given_name.
I’ve tried using the getUserInfo() method but that was only returning my user’s email.

I’m now trying to call the API /userinfo endpoint but the result is the same.
I’ve added the names properties as claims, but the result is the same, just email and sub.

Here are the options for my API call:

	var options = {
		method: "POST",
		headers: {
			'Content-Type': 'application/json',
			'Authorization': 'Bearer '+this.props.oktaAuth.getAccessToken(), 

and the call
fetch(config.oidc_widget.baseUrl+"/oauth2/default/v1/userinfo", options)

Any help will be appreciated,

Answering my own question.
I needed to assign the claims to “Id” token type instead of “Access”.
Then either using the okta-auth instance and the getUserInfo method or calling the API /userinfo endpoint showed the metadata.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.