/// <summary> /// Returns an app-only token for Microsoft Graph using the current authentication context authenticating the application /// using the given <paramref name="clientId"/> and <paramref name="clientSecret"/>. /// </summary> public static async Task <AuthenticationResult> AcquireAppOnlyGraphTokenAsync(this AuthenticationContext authContext, string clientId, string clientSecret) { return(await authContext.AcquireAppOnlyTokenAsync(AppSettings.GraphResourceId, clientId, clientSecret)); }
/// <summary> /// Returns an app-only token for the given resource. /// </summary> /// <param name="resourceId">The resource identifier for which to return the token.</param> /// <returns></returns> public static AuthenticationResult AcquireAppOnlyToken(this AuthenticationContext authContext, string resourceId) { return(AsyncHelper.RunSync(async() => await authContext.AcquireAppOnlyTokenAsync(resourceId))); }