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(); } }
... View more