Microsoft.Identity.Client.AuthenticationParameters.CreateFromResourceUrlCommonAsync C# (CSharp) Method

CreateFromResourceUrlCommonAsync() private static method

private static CreateFromResourceUrlCommonAsync ( Uri resourceUrl ) : Task
resourceUrl System.Uri
return Task
        private static async Task<AuthenticationParameters> CreateFromResourceUrlCommonAsync(Uri resourceUrl)
        {
            if (resourceUrl == null)
            {
                throw new ArgumentNullException("resourceUrl");
            }

            AuthenticationParameters authParams;

            try
            {
                HttpClientWrapper request = new HttpClientWrapper(resourceUrl.AbsoluteUri, null);
                using (await request.GetResponseAsync().ConfigureAwait(false))
                {
                    var ex = new MsalException(MsalError.UnauthorizedResponseExpected);
                    PlatformPlugin.Logger.Error(null, ex);
                    throw ex;                    
                }
            }
            catch (HttpRequestWrapperException ex)
            {
                PlatformPlugin.Logger.Error(null, ex);
                IHttpWebResponse response = ex.WebResponse;
                if (response == null)
                {
                    var serviceEx = new MsalServiceException(MsalErrorMessage.UnauthorizedHttpStatusCodeExpected, ex);
                    PlatformPlugin.Logger.Error(null, serviceEx);
                    throw serviceEx;
                }

                authParams = CreateFromUnauthorizedResponseCommon(response);
                
            }

            return authParams;
        }