Retrieve All Users From Auth0 - asp.net

I am using Auth0, And I want to retrieve all users of my client application.
Below is my code:
var apiClient = new ManagementApiClient("<<Token>>", new Uri("https://<<Domain>>/api/v2/users"));
var allClients = await apiClient.Users.GetAllAsync();
I am using token which includes Read:User permission in auth0.
But I am getting below error,
Path validation error: 'String does not match pattern ^.+\|.+$: users'
on property id (The user_id of the user to retrieve).
I read this arrticle, But I am not understanding, What changes I need to make in auth0.
https://auth0.com/forum/t/auth-renewidtoken-returns-a-user-id-validation-error/1151
What changed I need to make to solve it?

You need to create the ManagementApiClient in one of the following ways:
// Pass the base Uri of the API (notice it does not include the users path)
var api = new ManagementApiClient("[token]", new Uri("https://[account].auth0.com/api/v2"));
or
// Pass only the domain as a string
var api = new ManagementApiClient("[token]", "[account].auth0.com"));
You're including /users in the base API path which will then cause errors, like the one you observed.

Related

Get list of nest devices with .NET client API

I'm struggling to figure out how the smart device management API works.
The end goal is to fetch a status of my nest thermostat on an ongoing basis for logging purposes, using service account credentials:
await using var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
var credential = GoogleCredential.FromStream(stream)
.CreateScoped(SmartDeviceManagementService.ScopeConstants.SdmService);
var service = new SmartDeviceManagementService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential
});
This appears to be correct, however when I try and call service.Enterprises.Devices.List() it requires a parent ID in the format of "^enterprises/[^/]+/devices/[^/]+$ But I do not know how to acquire this parent ID to begin testing my code.
Does anyone know how to obtain these strings which seem to be necessary to use the API?
Have you registered from a project id via the Device Access Console?
https://console.nest.google.com/device-access
That seems to be what you're looking for.

Create an agreement for two signers via Rest API

How can we create an agreement using a library document using a library document which will be singed by two signers? I know how to do the same using echo sign web application using this tutorial: https://helpx.adobe.com/sign/help/send-agreement---multiple-signers.html
I have created a template document in my dashboard for reuse purpose and I have added fields for recipients as well. But when I create agreement using that library document and from that agreement I create signing url. But both URLs only allow one of them to sign. If the second signer opens their link, the document shows as already signed. Can anyone tell me how can I create and have my both signers complete the agreement using Rest API?
please change your lines of code from
//Create recipient set info
var recipientSetInfo = new agreementsModel.RecipientSetInfo();
recipientSetInfo.setRecipientSetMemberInfos(recipientSetMemberInfos);
recipientSetInfo.setRecipientSetRole(agreementsModel.RecipientSetInfo.RecipientSetRoleEnum.SIGNER);
recipientSetInfo.setRecipientSetName("fjenning#adobe.com");
var recipientSetInfos = [];
recipientSetInfos.push(recipientSetInfo);
to this
var recipientSetInfos = [];
//Create recipient set info
for (var i = 0; i < recipientSetMemberInfos.length; i++) {
var recipientSetInfo = new agreementsModel.RecipientSetInfo();
recipientSetInfo.setRecipientSetMemberInfos(recipientSetMemberInfos[i]);
recipientSetInfo.setRecipientSetRole(agreementsModel.RecipientSetInfo.RecipientSetRoleEnum.SIGNER);
recipientSetInfo.setSigningOrder("SEQUENTIAL");
recipientSetInfo.setRecipientSetName(" Recepients");
recipientSetInfos.push(recipientSetInfo);
}

Xamarin Azure Facebook get user info

I've been searching on the best way to get information my azure auth from facebook.
My app is getting the authentication and the id of the user! I am not sure what code I need next in order to get the information.
So far I have this
if (authenticated)
{
var client = new HttpClient();
var fbUser = await client.GetAsync(Appurl+".auth/me");
var response = await fbUser.Content.ReadAsStringAsync();
var jo = JObject.Parse(response);
var userName = jo["'typ':'user_id'"].ToString();
}
So far all the answers have left me clueless
I just need this to return name email and other Items I want.
I am sure this is an Json Parsing the wrong issue but I am not sure.
Please help!!!
I just need this to return name email and other Items I want. I am sure this is an Json Parsing the wrong issue but I am not sure.
If you visit https://yourmobileapp .azurewebsites.net/.auth/me from browser, and login with your FaceBook account. Then you could get the Json structs as following. It is a JArray . So please have a try to use following code, it works correctly on my side.
var ja = JArray.Parse(response);
var id = ja[0]["user_id"];
Before that we need to add email scope on the Azure portal, about how to add email scope, please refer to the screenshot.

use isMemberOf by group name in Azure AD Graph API

As part of an Azure AD Graph call, I have the following request.Content:
var requestString = "{\"groupId\":\"xxxx\",\"memberId\":\"yyyy\"}";
request.Content = new StringContent(requestString, Encoding.UTF8, "application/json");
Where xxxx is the guid of the group and yyyy is the guid of the user. This works. Returns true.
Now I would like to be able to send a similar request that sends the names of the group and the user instead of guids. That is:
var requestString = "{\"groupId\":\"webdevs\",\"memberId\":\"bob\"}";
request.Content = new StringContent(requestString, Encoding.UTF8, "application/json");
This call does not work and I realize this might not be possible. Maybe I need to fetch the guids by the user/group names, but I'm not sure how to do that either.
Any help?
Thanks!
The IsMemberOf REST only supports to request using the groupId and memberId like below:
You were right, we can get the groupId first via the group name then call this REST API to check the membership. And we can use the $filter parameter in the REST like below get the guids of user/group via their name:
Get https://graph.windows.net/adb2cfei.onmicrosoft.com/groups?api-version=1.6&$filter=displayName+eq+'GroupName'
Get https://graph.windows.net/adb2cfei.onmicrosoft.com/users?api-version=1.6&$filter=displayName+eq+'UserName’
You can refer this REST about more detail from here.

Get Google analytics data using Oauth token?

Here I am using asp.net web to display Google analytic data. I am successfully able to get access token using oauth2.0. Using access token I am also get account information.
Here I want to get Google analytic data using access token. Please share link with me to get data using access token.
I have seen following code
http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/Analytics_DataFeed_Sample/dataFeed.cs
But don't want to use it because here I have to pass user name and password:
private const String CLIENT_USERNAME = "INSERT_LOGIN_EMAIL_HERE";
private const String CLIENT_PASS = "INSERT_PASSWORD_HERE";
Let me know any way to get analytic data using access token.
After long work will get success.....
Here is Oauth playground made by Google developer from you can test your data
https://code.google.com/oauthplayground/
I just Oauth 2.0 for retrieve access token information after that I am using following URL for getting analytic information.
https://developers.google.com/analytics/devguides/reporting/core/v2/gdataReferenceDataFeed
you need to pass access token with your URL ie :
https://www.googleapis.com/analytics/v2.4/data?ids=ga:12345&metrics=ga:visitors,ga:bounces&start-date=2012-07-01&end-date=2012-07-25&access_token=ya29.AHES6ZTzNR6n6FVcmY8uar6izjP9UGeHYNO5nUR7yU2bBqM
Best of luck Enjoy coding..
You can try with following code
string ClientId = "CLIENTID"
string ClientSecret = "CLIENTSECRET"
var Client = new NativeApplicationClient(GoogleAuthenticationServer.Description, ClientId, ClientSecret);
var Auth = new OAuth2Authenticator<NativeApplicationClient>(Client, Authenticate);
var Service = new AnalyticsService(Auth);
var Request = Service.Data.Ga.Get("profileID", StartDate, EndDate, "Matrix");
Request.MaxResults = 1000;
Request.Dimensions = "Dimensions";
var Result = Request.Fetch();

Resources