GetAuthorizationRequestUrlAsync() public method

Gets URL of the authorize endpoint including the query parameters.
public GetAuthorizationRequestUrlAsync ( string scope, string loginHint, string extraQueryParameters ) : Task
scope string
loginHint string
extraQueryParameters string
return Task
        public void GetAuthorizationRequestUrlDuplicateParamsTest()
        {

            ConfidentialClientApplication app = new ConfidentialClientApplication(TestConstants.DefaultClientId,
                TestConstants.DefaultRedirectUri, new ClientCredential(TestConstants.DefaultClientSecret), new TokenCache());
            try
            {
                Task<Uri> task = app.GetAuthorizationRequestUrlAsync(TestConstants.DefaultScope.AsArray(),
                    TestConstants.DefaultDisplayableId, "[email protected]");
                Uri uri = task.Result;
                Assert.Fail("MSALException should be thrown here");
            }
            catch (Exception exc)
            {
                Assert.IsTrue(exc.InnerException is MsalException);
                Assert.AreEqual("duplicate_query_parameter", ((MsalException)exc.InnerException).ErrorCode);
                Assert.AreEqual("Duplicate query parameter 'login_hint' in extraQueryParameters", ((MsalException)exc.InnerException).Message);

            }
        }
 public void GetAuthorizationRequestUrlCustomRedirectUriTest()
 {
     ConfidentialClientApplication app = new ConfidentialClientApplication(TestConstants.DefaultClientId,
         TestConstants.DefaultRedirectUri, new ClientCredential(TestConstants.DefaultClientSecret), new TokenCache());
     Task<Uri> task = app.GetAuthorizationRequestUrlAsync(TestConstants.DefaultScope.AsArray(),
         "custom://redirect-uri", TestConstants.DefaultDisplayableId, "extra=qp&prompt=none",
         TestConstants.ScopeForAnotherResource.AsArray(), TestConstants.DefaultAuthorityGuestTenant,
         TestConstants.DefaultPolicy);
     Uri uri = task.Result;
     Assert.IsNotNull(uri);
     Assert.IsTrue(uri.AbsoluteUri.StartsWith(TestConstants.DefaultAuthorityGuestTenant, StringComparison.CurrentCulture));
     Dictionary<string, string> qp = EncodingHelper.ParseKeyValueList(uri.Query.Substring(1), '&', true, null);
     Assert.IsNotNull(qp);
     Assert.AreEqual(12, qp.Count);
     Assert.AreEqual("r1/scope1 r1/scope2 r2/scope1 r2/scope2 openid offline_access", qp["scope"]);
     Assert.AreEqual(TestConstants.DefaultClientId, qp["client_id"]);
     Assert.AreEqual("code", qp["response_type"]);
     Assert.AreEqual("custom://redirect-uri", qp["redirect_uri"]);
     Assert.AreEqual(TestConstants.DefaultDisplayableId, qp["login_hint"]);
     Assert.AreEqual("MSAL.Desktop", qp["x-client-sku"]);
     Assert.IsFalse(string.IsNullOrEmpty(qp["x-client-ver"]));
     Assert.IsFalse(string.IsNullOrEmpty(qp["x-client-cpu"]));
     Assert.IsFalse(string.IsNullOrEmpty(qp["x-client-os"]));
     Assert.AreEqual("qp", qp["extra"]);
     Assert.AreEqual("none", qp["prompt"]);
     Assert.AreEqual(TestConstants.DefaultPolicy, qp["p"]);
 }