Exemple #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));
 }
Exemple #2
0
 /// <summary>
 /// Creates an unauthenticated client for use in Store apps that uses the OnlineIdAuthenticator API 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 GetUniversalClient(
     string[] scopes,
     string returnUrl           = null,
     IHttpProvider httpProvider = null)
 {
     return(OneDriveClientExtensions.GetClientUsingOnlineIdAuthenticator(scopes, returnUrl, httpProvider));
 }
Exemple #3
0
 /// <summary>
 /// Creates an unauthenticated client for use in Store apps that uses the OnlineIdAuthenticator API 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>
 /// <param name="promptType">The credential prompt type (show or hide the credential prompt user interface)</param>
 /// <returns>The <see cref="IOneDriveClient"/> for the session.</returns>
 public static IOneDriveClient GetUniversalClient(
     string[] scopes,
     string returnUrl                = null,
     IHttpProvider httpProvider      = null,
     CredentialPromptType promptType = CredentialPromptType.PromptIfNeeded)
 {
     return(OneDriveClientExtensions.GetClientUsingOnlineIdAuthenticator(scopes, returnUrl, httpProvider, promptType));
 }
Exemple #4
0
        /// <summary>
        /// Creates an authenticated client for use in Store apps that uses the OnlineIdAuthenticator API 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 async Task <IOneDriveClient> GetAuthenticatedUniversalClient(
            string[] scopes,
            string returnUrl           = null,
            IHttpProvider httpProvider = null)
        {
            var client = OneDriveClientExtensions.GetClientUsingOnlineIdAuthenticator(scopes, returnUrl, httpProvider);
            await client.AuthenticateAsync();

            return(client);
        }
Exemple #5
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);
        }