Azure Native Client Authentication
1 answer
You can use the AcquireToken method as shown below. A browser dialog box will appear asking for your credentials.
private static string GetToken(string authority, string clientId, string redirectUri)
{
var authContext = new AuthenticationContext(authority, validateAuthority: false);
var result = authContext.AcquireToken("https://graph.windows.net",
clientId, new Uri(redirectUri), PromptBehavior.Auto);
return result.AccessToken;
}
If you want to authenticate without prompting for a user, see Granting permission to grant resource owner rights. This is explained in this article by Vittorio Bertocci.
+1
source to share