0

With reference from this URI:

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

I have tried using the /authorize endpoint but I am not getting a token back in the result from Okta, I always get the result as:

404 - Page Not Found

The page you are looking for can't be found. Please go to your applications page and try again.

Can anyone help me on this? Sent email to Okta developer but I'm not getting a reply.

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();
Joël Franusic
  • 1,178
  • 8
  • 18
R Kumar
  • 157
  • 1
  • 2
  • 12
  • Have you added the redirect_uri to your allowed list of redirects? https://xxx-admin.okta.com/admin/app/oidc_client/instance/{app}/#tab-general Also in my experience, it didn't allow localhost -- I instead used my computer name. – Larchy Feb 09 '17 at 23:00
  • I don't know if this helps, but there is a public tool that has working examples of an OIDC authentication with Okta. Here is a direct link: https://oktaproxy.com/oidcgenerator.php – user3888307 Mar 01 '17 at 04:58
  • localhost will work, http requests will work as well. You do need to make sure you add the redirect_uri on the general tab for the application. You can all multiple for an OIDC Application – user3888307 Mar 01 '17 at 04:59

1 Answers1

1

Looks like you're doing a POST for your method. I think it should be a GET.

drexel sharp
  • 323
  • 1
  • 9