0

参考此 URI:

http://developer.okta.com/docs/api/resources/oidc.html#parameter-details

我尝试使用/authorize端点,但我没有从 Okta 的结果中获得令牌,我总是得到如下结果:

404页面不存在

找不到您要查找的页面。请转到您的应用程序页面,然后重试。

谁可以帮我这个事?向 Okta 开发人员发送了电子邮件,但我没有收到回复。

var url = "https://xxx-admin.okta.com/oauth2/v1/authorize";
//string urlParams =
//    string.Format("response_type={0}&client_id={1}&redirect_uri={2}&scope={3},state={4},nonce={5}", "code",
//        "xxxxxx", redirecturl, "email", "email", );

var urlParameters =
    $"?idp={"okta"}&response_type={"id_token"}&client_id={"xxxxx"}&redirect_uri={redirecturl}" +
    $"&scope={"openid profile email address"}&response_mode={"form_post"}&state={"email"}&nonce={"nonce"}";

string redirecturl = "http://localhost/";
//grant_type,code,refresh_token,scope,redirect_uri,client_id,client_secret
var urlParameters = $"?grant_type={"password"}&code={""}&refresh_token={""}&redirect_uri={redirecturl}&" +
    $"client_id=xxxxx&client_secret=yyyyyy";
var url = "https://xxxx-admin.okta.com/oauth2/v1/token";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url+ urlParameters);

req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
var strRequest= string.Empty;
StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
string strResponse = streamIn.ReadToEnd();
streamIn.Close();
return strResponse.ToString();
4

1 回答 1

1

看起来你正在为你的方法做一个 POST 。我认为它应该是一个GET。

于 2017-06-30T20:42:34.603 回答