Getting ApiException: Unauthorized .Net AuthenticationApiClient

Hi

I’m trying to get /userinfo using the .Net SDK AuthenticationApiClient, but I can only get the I allways end up with the ApiException: Unauthorized.

In the Startup I have the options.Scope.Add("openid"); in my scopes.

My code itself:

  public object UserInformation {  get
  	{
  		if(_userInformation == null)
  		{
  			string accessToken = _User.Claims.FirstOrDefault(c => c.Type == "access_token").Value;

  			if (!string.IsNullOrEmpty(accessToken))
  			{
  				var apiClient = new AuthenticationApiClient(new Uri("https://xxx.eu.auth0.com"));
  				var userInfo = apiClient.GetUserInfoAsync(accessToken).Result;
  				this._userInformation = userInfo;
  			}
  		}

  		return this._userInformation;
  	}
  }

I’ve spent many hours now scouring the docs and other resources, and could really use a pointer right now :smiley:

Hey there!

Sorry for such delay in response! We’re doing our best in providing the best developer support experience out there, but sometimes the number of incoming questions is just too big for our bandwidth. Sorry for such inconvenience!

Do you still require further assistance from us?