Пример #1
0
 /// <summary>
 /// Creates an unauthenticated client that uses the WebAuthenticationBroker API in SSO mode for authentication.
 /// </summary>
 /// <param name="appId">The application ID for Microsoft account authentication.</param>
 /// <param name="scopes">The requested scopes for Microsoft account authentication.</param>
 /// <param name="httpProvider">The <see cref="IHttpProvider"/> for sending HTTP requests.</param>
 /// <returns>The <see cref="IOneDriveClient"/> for the session.</returns>
 public static IOneDriveClient GetClientUsingWebAuthenticationBroker(
     string appId,
     string[] scopes,
     IHttpProvider httpProvider = null)
 {
     return(OneDriveClientExtensions.GetClientUsingWebAuthenticationBroker(appId, /* returnUrl */ null, scopes, httpProvider));
 }
Пример #2
0
        /// <summary>
        /// Creates an authenticated client that uses the WebAuthenticationBroker API in non-SSO mode for authentication.
        /// </summary>
        /// <param name="appId">The application ID for Microsoft account authentication.</param>
        /// <param name="returnUrl">The application return URL for Microsoft account authentication.</param>
        /// <param name="scopes">The requested scopes for Microsoft account authentication.</param>
        /// <param name="httpProvider">The <see cref="IHttpProvider"/> for sending HTTP requests.</param>
        /// <returns>The <see cref="IOneDriveClient"/> for the session.</returns>
        public static async Task <IOneDriveClient> GetAuthenticatedClientUsingWebAuthenticationBroker(
            string appId,
            string returnUrl,
            string[] scopes,
            IHttpProvider httpProvider = null)
        {
            var client = OneDriveClientExtensions.GetClientUsingWebAuthenticationBroker(
                appId,
                returnUrl,
                scopes,
                httpProvider);

            await client.AuthenticateAsync();

            return(client);
        }