开发者

How to get the 'NerdDinner' OpenID popup window working

So I'm trying to implement OpenID using NerdDinner 2 as an example. When you click on one of the OpenID providers, you get a popup window that looks like the screenshot 开发者_StackOverflow社区below. I've got most of the underlying code setup correctly and my login page loads and displays the three provider buttons, but when I click on them, there's no popup. It doesn't do anything at all. No JS errors, just nothing happens. What am I missing?

I've looked through the NerdDinner code but I'm having trouble trying to figure out exactly what causes the popup to occur. I don't necessarily need someone to tell me what's wrong with my app, I just need to know what I'm looking for in the NerdDinner app that causes it to happen so I can compare it with mine.

I'm using the following code to render the buttons:

@model dynamic
@using DotNetOpenAuth.Mvc;
@using DotNetOpenAuth.OpenId.RelyingParty;
<div id="login-oauth">
    <fieldset>
        <legend>via 3rd Party (recommended)</legend>
        @using (Html.BeginForm("LogOnPostAssertion", "Auth"))
        {
            @Html.Hidden("ReturnUrl", Request.QueryString["ReturnUrl"], new { id = "ReturnUrl" })
            @Html.Hidden("openid_openidAuthData")
            <div>
                @MvcHtmlString.Create(Html.OpenIdSelector(new SelectorButton[] {
new SelectorProviderButton("https://me.yahoo.com/", Url.Content("~/Content/images/yahoo.gif")),
new SelectorProviderButton("https://www.google.com/accounts/o8/id", Url.Content("~/Content/images/google.gif")),
new SelectorOpenIdButton(Url.Content("~/Content/images/openid.gif")),
}))
                <div class="helpDoc">
                    <p>
                        If you have logged in previously, click the same button you did last time!!
                    </p>
                </div>
            </div>
        }
    </fieldset>
</div>
@{     
    var options = new OpenIdSelector();
    options.TextBox.LogOnText = "Log On";
}
@MvcHtmlString.Create(Html.OpenIdSelectorScripts(options, null))

EDIT: This happens in all browsers and there are no popup blockers.

How to get the 'NerdDinner' OpenID popup window working


For some reason, changing the following route in global.asax.cs from:

routes.MapRoute(
    "OpenIdDiscover",
    "Auth/Discover");

to:

routes.MapRoute(
    "OpenIdDiscover",
    "Auth/Discover",
    new { controller = "Auth", action = "Discover" }
);

Seems to have fixed the problem. No idea why, but looking at the requests with Firebug showed a 500 error attempting to access this route.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜