.Net client library for the Auth0 platform.
Install-Package Auth0
Create an instance of Client with the credentials provided in the settings section of the dashboard.
var client = new Auth0.Client(
clientID: "your-client-id",
clientSecret: "your-client-secret",
domain: "yourdomain.auth0.com"
);
Return a list of all the connections in your application:
var connections = client.GetConnections();
Returns an IEnumerable. Additionally there is a GetSocialConnections
and GetEnterpriseConnections
.
Let's say one of your customers wants to use its own directory to authenticate to your app. You will have to create a connection in Auth0 for this customer and if you want to automate that for N customers, you will want to use the API. Typically, you will ask the customer domain name and depending on the directory you are connecting to, some metadata.
var connectionTicket = new Auth0.Connection("office365", "contoso.com");
var newConnection = client.CreateConnection(connectionTicket);
// newConnection will have ProvisioningTicketUrl
Because this example uses Office 365, the returned connection object will have a ProvisioningTicketUrl
property to which you have to redirect the client in order to complete the authorization process.
Create connection using a provisioning ticket.
var newConnection = client.CreateConnection(provisioningTicket);
Delete a connection identified by connectionName.
client.DeleteConnection(connectionName);
This method returns a list of users of the connection.
It will search the users on the directory of the connection. Suppose it is a Windows Azure Active Directory connection it will fetch all the users from the directory. If the connection doesn't have a directory or it is a Social connection like Google OAuth 2 it will return all the users that have logged in to your application at least once.
var users = client.GetUsersByConnection("contoso.com");
// or
var users = client.GetUsersByConnection("contoso.com", "jdoe");
The result is an IEnumerable<Auth0.User>.
The same than GetUsersByConnection
but this method returns users for all social connections ie: not enterprise connections.
var users = client.GetSocialUsers("[email protected]");
// or
var users = client.GetSocialUsers();
The same than GetUsersByConnection
but this method returns users for all enterprise connections ie: not social connections.
var users = client.GetEnterpriseUsers("[email protected]");
// or
var users = client.GetEnterpriseUsers();
This library is useful to consume the http api of Auth0, in order to authenticate users you can use our platform specific SDKs:
For more information about auth0 visit our documentation page.
This client library is MIT licensed.