Got a 'How do I' question? Join our live 'Ask a Trainer' session happening now for instant help and pro tips!

Difficulty connecting with V3

BobM742
Rookie
0 Votes

I do some work in c# but am new to OAUTH2.  I've created a web app for v3 by following the hints in the documentation and some of the conversations in the community.  Using the HttpClient I can get an OK response to my GetAsync command, but I'm never prompted to login and it just returns to the same page where I started (https://localhost:44365).  If I run the URI https://api.cc.email/v3/idfed?client_id= and so on I do get prompted to log in but I never get to the localhost Redirect URI, I just get sent back to the https://api.cc...... page.

 

I've tried this as server flow and client flow and always end up with no login but no message either.

 

Any help would be appreciated so I can try something different.  At this point I keep getting same result so I need to start again.

 

If it helps here it the code I'm running from a button on Default.aspx.  I've tried a redirect of default.aspx as well as WebForm1 shown below.  

public async void getCreds()

        {

            string u = System.Web.HttpUtility.UrlEncode("https://localhost:44356/WebForm1");

            clientFlow cf = new clientFlow();

            HttpClient httpClient = new HttpClient();

            string y = cf.getAuthorizationUrl(u, "ccccccccccccccccccc");

            Uri z = new Uri(y);

            var httpResponseMessage1 = await httpClient.GetAsync(z);

 

        }

        public void Button1_Click(object sender, EventArgs e)

        {

            Task rslt = new Task(getCreds);

            rslt.Start();

        }

        public class clientFlow

        {

            public string getAuthorizationUrl(string redirectUri, string clientId)

            {

                StringBuilder authURL = new StringBuilder();

                authURL.Append("https://api.cc.email/v3/idfed?client_id=");

                authURL.Append(clientId);

                authURL.Append("&scope=contact_data");

                authURL.Append("&response_type=code");

                authURL.Append("&redirect_uri=");

                authURL.Append(redirectUri);

                return authURL.ToString();

            }

        }

 

1 REPLY 1
BobM742
Rookie
0 Votes

I was developing on a Mac with Parallels running.  I created a clean Win 10 install with VS 2019 and made it much further.  Now if I copy the https://api.cc.email/v3.......... URL and run manually I at the call back works and I get an access_token. 

 

I guess something about the combination of a Mac and Parallels keeps the process from running.

 

Now to get the URL to load automatically

Resources
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up

Polls
How confident are you about the effectiveness of your current marketing strategy?

Top Choice: Not confident at all (76%)