Reputation: 16420
I'm using this tutorial: http://www.dotnetopenauth.net/developers/help/programmatic-openid-relying-party/
My GetResponse() call always returns null, I've also added localhost to my white list in the web.config. I feel like I've done everything right & can't find a solution on line. In debug when I look at the openid object. I has a count of 2 discovery services..
I call the method below from a JS click.
[HttpPost]
public void PingOpenID()
{
var openid = new OpenIdRelyingParty();
IAuthenticationResponse response = openid.GetResponse();
if (response != null)
{
switch (response.Status)
{
case AuthenticationStatus.Authenticated:
FormsAuthentication.RedirectFromLoginPage(
response.ClaimedIdentifier, false);
break;
case AuthenticationStatus.Canceled:
ModelState.AddModelError("loginIdentifier",
"Login was cancelled at the provider");
break;
case AuthenticationStatus.Failed:
ModelState.AddModelError("loginIdentifier",
"Login failed using the provided OpenID identifier");
break;
}
}
}
Upvotes: 0
Views: 1237
Reputation: 81791
Your question mentioned you calling this method from "a JS click". That's not how OpenID works. The OpenID response message comes from the provider via redirect to the RP, not some JS running on the browser. GetResponse()
is likely returning null because your JS is sending an empty POST to the RP and doesn't include the OpenID payload in it.
Note there are some exotic cases where the RP's javascript at the browser does "forward" the OpenID response to the RP server, but that's very advanced and not likely what you're trying to accomplish from what your question sounds like.
Upvotes: 1