Skip to content

Instantly share code, notes, and snippets.

@wictorwilen
Created February 12, 2015 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wictorwilen/866aef50f9996934d08a to your computer and use it in GitHub Desktop.
Save wictorwilen/866aef50f9996934d08a to your computer and use it in GitHub Desktop.
Azure AD AuthN stuff
string resourceId = "<resource id>";
// Can be:
// For SharePoint (CSOM), tenant Url: https://tenant.sharepoint.com
// For Azure AD Graph: https://graph.windows.net
// For Office 365 Discovery: https://api.office.com/discovery/
// For Exchange Online: https://outlook.office365.com/
string secret = "<App client secret>"; // a generated guid
Uri redirectUri = new Uri("<App redirect Uri>"); // for instance app://my-app
AuthenticationContext context = new AuthenticationContext("https://login.windows.net/common");
AuthenticationResult result = context.AcquireToken(resourceId, secret, redirectUri);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment