Closed nfMalde closed 8 years ago
Not sure if related, but you should URL encode the redirect_uri value.
Done. I also removed all parameters except client_id and response_type. Request is still cancelled.
Here is the code where im redirecting:
if(Session["twitch.state"] != null)
{
Session.Remove("twitch.state");
}
Session.Add("twitch.state", "request" + Guid.NewGuid().ToString().ToLower());
string url = "https://api.twitch.tv/kraken/oauth2/authorize?response_type=code"
+ "&client_id={0}"
+ "&redirect_uri={1}"
+ "&scope={2}"
+ "&state={3}";
string absUrl = new System.UriBuilder(Request.Url.AbsoluteUri)
{
Path = Url.Action("Authorize"),
Query = "redirect_to="+ HttpUtility.UrlEncode( redirect_to),
}.Uri.ToString();
url = String.Format(url,
HttpUtility.UrlEncode(ConfigurationManager.AppSettings["twitch.clientID"]),
HttpUtility.UrlEncode(absUrl),
HttpUtility.UrlEncode("user_read channel_read"),
HttpUtility.UrlEncode(Session["twitch.state"].ToString())
);
return Redirect(url);
If this isn't resolved, I would re-ask in the Twitch Developer Forums.
Hi Im testing arround at the moment with the Twitch API.
Im Testing on: .NET MVC 5, Localhost. I tryed to redirect the user to https://api.twitch.tv/kraken/oauth2/authorize?response_type=code&client_id=....&redirect_uri=http://localhost:63477/ExternalConnections/Twitch/Authorize&scope=user_read+channel_read&state=...
Somehow the request is getting canceled by chrome. Firefox is working. Is there something wrong in my call or why is only chrome canceling the request?
Here is a screenshot from the network tab:![twitchrequest](https://cloud.githubusercontent.com/assets/5366984/14228078/98516024-f90b-11e5-8576-de99efcdae4b.png)