Sample code for GetUserInfoAsync() by C#

Hello.
Where can I find sample code for GetUserInfoAsync() in C#?
I have been trying to get user info but have not been successful.
I’m assuming there is something wrong with getting the token,
but there may be something else wrong,
so if you have a sample where I can see the whole procedure from the beginning,
please let me know.

Thank you for thinking of me.

In the MainPage#DisplayResult method of the above sample code

var userInfo = await client.GetUserInfoAsync(loginResult.AccessToken);

and added GetUserInfoAsync works.

However, the information I got was the same as what the loginResult contains.
I would like to get the other user’s information, like the Auth0 dashboard can display it.

https://auth0.github.io/auth0.net/

I am trying the ManagementApiClient class step by step, looking at the above. I used loginResult.AccessToken for token, and the connection seems to succeed.
However, I get a CS7036 error at the following location.

var allClients = await apiClient.Clients.GetAllAsync();

Getting a users information from Auth0.

I found the above site and did the following.
The IntelliSense response was promising.
Unfortunately, it throws an exception.

apiClient = new ManagementApiClient(loginResult.AccessToken, new Uri(“https://.auth0.com/api/v2/"));
var memberId = "
”;
var memberInfo = await apiClient.Users.GetAsync(memberId);


Auth0.Core.Exceptions.ErrorApiException
HResult=0x80131500
Message=Bad HTTP authentication header format
Source=Auth0.ManagementApi
stack trace:
at Auth0.ManagementApi.HttpClientManagementConnection.d__191.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Auth0.ManagementApi.HttpClientManagementConnection.<GetAsyncInternal>d__151.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Auth0.ManagementApi.HttpClientManagementConnection.<>c__DisplayClass13_01.<<GetAsync>b__0>d.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Auth0.ManagementApi.HttpClientManagementConnection.<Retry>d__261.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Auth0.ManagementApi.HttpClientManagementConnection.d__131.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at UWPSample.MainPage.d__5.MoveNext()

Yes!!!
Finally I have successfully retrieved the user data with the code below.
Next I want to retrieve the list of users. Please tell me about the ??? below.
var allUser = await apiClient.Users.GetAllAsync(???) ;

/*
** Get Management API Access Tokens for Production
** Get Management API Access Tokens for Production
*/
var restClient = new RestClient(“https://xxxxxxxxxxxxxxxxx.auth0.com/oauth/token”);
var request = new RestRequest(“”, Method.Post);
request.AddHeader(“content-type”, “application/x-www-form-urlencoded”);
var clientId = “xxxxxxxxxxxxxxxxxx”;//Machine to Machine
var clientSecret = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”; //Machine to Machine
var audience = “https://xxxxxxxxxxxx.auth0.com/api/v2/”;
request.AddParameter(
“application/x-www-form-urlencoded”,
$“grant_type=client_credentials&client_id={clientId}&client_secret={clientSecret}&audience={audience}”,
ParameterType.RequestBody
);
RestResponse response = restClient.Execute(request);
var obj = JsonConvert.DeserializeObject(response.Content);
string token = obj.access_token;

/*
** Get User Info
** Getting a users information from Auth0.
*/
var apiClient = new ManagementApiClient(token, new Uri(“https://xxxxxxxxxxx.auth0.com/api/v2/”));
var userId = “xxxxxxxxxxxxxxxxxxxxxxxxx”;
var userInfo = await apiClient.Users.GetAsync(userId);
Console.WriteLine($“fullname: {userInfo.FullName}”);
Console.WriteLine($“Email: {userInfo.Email}”);

It is done for now.

var users = apiClient.Users.GetAllAsync(new GetUsersRequest());

I don’t understand how to use GetUsersRequest from the manual,
so can you give me some specific examples?