asp.net mvc を使用して OnTime OnDemand API の認証トークンを取得しようとしています。以下は、トークンを取得するための簡単なアクション メソッドです。
public ActionResult Index()
{
string eURL = HttpUtility.UrlEncode("http://localhost:2574/OnTimeClient/AuthorizationCodeCallback");
return Redirect("https://iss.ontimenow.com/auth?response_type=code&client_id=6457eb4e-42c7-4c19-ad25-73fc0d016e5a&redirect_uri=" +eURL+"&scope=read%20write");
}
public ActionResult AuthorizationCodeCallback(string code, string error)
{
return Redirect("https://iss.ontimenow.com/api/oauth2/token?grant_type=authorization_code&code="+code+"&redirect_uri=www.yahoo.com&client_id=6457eb4e-42c7-4c19-ad25-73fc0d016e5a&client_secret=8538c23b-211f-4351-bfe9-f533e81c97bf");
}
{"error":"invalid_grant"} を受け取りました。