/// <summary> /// Init Group Hub api service, when invoking this, it will prompt a logon window, customer need to input the password /// </summary> /// <param name="region">region of your tenant</param> /// <param name="office365TenantId">office 365 tenant id of your tenant</param> /// <param name="userName">your user name</param> private static void Initilize(Region region, String office365TenantId, String userName) { var clientId = "d3590ed6-52b3-4102-aeff-aad2292ab01c"; var redirectUri = "urn:ietf:wg:oauth:2.0:oob"; var resource = "https://graph.microsoft.com"; var authority = $"https://login.windows.net/{office365TenantId}"; var authenticationContext = new AuthenticationContext(authority); var userId = new UserIdentifier(userName, UserIdentifierType.OptionalDisplayableId); var result = authenticationContext.AcquireToken(resource, clientId, new Uri(redirectUri), PromptBehavior.Always, userId); AuthenticationTokenModel model = new AuthenticationTokenModel(); model.AccessToken = result.AccessToken; model.RefreshToken = result.RefreshToken; GroupHubApi.Init(region, model); }