No OpenID endpoint found
Asked Answered
C

4

5

I am trying to use the DotNetOpenId library to add OpenID support on a test website. For some reason it keeps giving me the following error when running on Firefox. Keep in mind that I am using localhost as I am testing it on my local machine.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.RelyingParty;

namespace TableSorterDemo
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var openid = new OpenIdRelyingParty();
            if (openid.GetResponse() != null)
            {
                switch (openid.GetResponse().Status)
                {
                    case AuthenticationStatus.Authenticated:
                        var fetch = openid.GetResponse().GetExtension(typeof(ClaimsResponse)) as ClaimsResponse;
                        var nick = fetch.Nickname;
                        var email = fetch.Email;

                        break;
                }
            }
        }

        protected void OpenIdLogin1_LoggedIn(object sender, OpenIdEventArgs e)
        {
            var openid = new OpenIdRelyingParty(); 
            if(openid.GetResponse() != null)
            {
                switch(openid.GetResponse().Status)
                {
                    case AuthenticationStatus.Authenticated:
                        var fetch = openid.GetResponse().GetExtension(typeof (ClaimsResponse)) as ClaimsResponse;
                        var nick = fetch.Nickname;
                        var email = fetch.Email; 

                        break; 
                }
            }


        }

        protected void OpenIdLogin1_LoggingIn(object sender, OpenIdEventArgs e)
        {
            var openid = new OpenIdRelyingParty();
            var req = openid.CreateRequest(OpenIdLogin1.Text);
            var fetch = new ClaimsRequest();
            fetch.Email = DemandLevel.Require;
            fetch.Nickname = DemandLevel.Require; 
            req.AddExtension(fetch);
            req.RedirectToProvider();
            return; 
        }


    }
}

Also, if I run the same page in Chrome then I get the following:

Login failed: This message has already been processed. This could indicate a replay attack in progress.

Cottage answered 26/3, 2010 at 0:48 Comment(1)
Your question includes "giving me the following error when running on FireFix." Firefix? And you left out the error you get.Manille
M
5

The replay attack detection results from you calling GetResponse() twice. You must not do that. Instead, assign the result of just one call to GetResponse() to a local variable, and then check it against null and use it otherwise.

Regarding you "No OpenID endpoint found" error, are you testing against a localhost OpenID as well or an OpenID hosted by an external party like Yahoo?

Manille answered 26/3, 2010 at 16:11 Comment(2)
I am testing against locahost OpenID.Cottage
Then make sure your RP's web.config file allows for localhost OpenIDs, as shown in this web.config file: github.com/AArnott/dotnetopenid/blob/master/samples/… by the <add name="localhost" /> tag.Manille
R
4

In my case as I was using a proxy to connect to the internet, I resolved by adding the following configuration to the web.config.

<system.net>
 <defaultProxy useDefaultCredentials="true">
  <proxy autoDetect="True" usesystemdefault="True" />
 </defaultProxy>
</system.net>
Rabkin answered 14/6, 2011 at 1:16 Comment(0)
F
0

Its worth noting that the 'No OpenID endpoint found' error message may not be a true description of what the issue is.

For myself it was because I was using my gmail email address but actually you need to create an OpenId account you will then get an id in the format .myopenid.com/

Enter that Id into the form and it should work correctly.

Forefoot answered 3/6, 2013 at 8:52 Comment(0)
G
0

Check the web.config in your client app. There is a section

                    <!-- Uncomment to enable communication with localhost (should generally not activate in production!) -->
                <!--<add name="localhost" />-->

So as it says - uncomment to
<add name="localhost" />
Gandy answered 1/4, 2015 at 13:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.