Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ShayMe21/d71533660189e808a342bf23b0626685 to your computer and use it in GitHub Desktop.
Save ShayMe21/d71533660189e808a342bf23b0626685 to your computer and use it in GitHub Desktop.
// https://auth0.github.io/auth0.net/index.html
// https://auth0.github.io/auth0.net/api/Auth0.AuthenticationApi.Models.ClientCredentialsTokenRequest.html
public async void getapi2token(){
var AuthAPI = new AuthenticationApiClient(new Uri("https://shayan-dev.au.auth0.com/"));
var api2Response = await AuthAPI.GetTokenAsync(new ClientCredentialsTokenRequest
{
ClientId = "43BKVc57RgIiVJrbM8gRDIBQgofdByYe",
ClientSecret = "xxx",
Audience = string.Format("https://{0}/api/v2/", "shayan-dev.au.auth0.com")
});
System.Console.Write(api2Response.AccessToken.ToString() + "\n"); // This is our Access Token
var managementApi = new ManagementApiClient(api2Response.AccessToken.ToString(), new Uri(string.Format("https://{0}/api/v2", "shayan-dev.au.auth0.com")));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment