質問

しかも起きています。

していま築ASP.NET MVC5サイトは、地域の金クラスタを経由ASP.NET ます。

私は現しようとする外部認証が凄味が追加されています。

をあしらったデザインとなっていをする。私はこの私で起動します。Auth.cs:

    public void ConfigureAuth(IAppBuilder app)
    {
        // Enable the application to use a cookie to store information for the signed in user
        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Account/Login")
        });
        // Use a cookie to temporarily store information about a user logging in with a third party login provider
        app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

        // Uncomment the following lines to enable logging in with third party login providers
        //app.UseMicrosoftAccountAuthentication(
        //    clientId: "",
        //    clientSecret: "");

        //app.UseTwitterAuthentication(
        //   consumerKey: "",
        //   consumerSecret: "");

        //app.UseFacebookAuthentication(
        //   appId: "",
        //   appSecret: "");

        app.UseGoogleAuthentication();
    }

ユーザがクリックした際の飛び、リンクをクリックにログオンのGoogleのExternalLogin方法:

    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public ActionResult ExternalLogin(string provider, string returnUrl)
    {
        // Request a redirect to the external login provider
        return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
    }

いて検証を経由のデバッグがExecuteResult法のChallengeResultクラス:

        public override void ExecuteResult(ControllerContext context)
        {
            var properties = new AuthenticationProperties() { RedirectUri = RedirectUri };
            if (UserId != null)
            {
                properties.Dictionary[XsrfKey] = UserId;
            }
            context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider);
        }

しかし、ブラウザ、何も起こりません。私たちは空白のページを参考にして設定にリダイレクトにGoogle signinページです。

誤りがないか報告されます。

その他の面白いことにしていこうという思いを込めて別のMVC5アプリケーションですが、私は"オブジェクト参照に設定されないオブジェクトのインスタンス"のポップアップにVS2013、そのプロジェクトが抜けてのコントローラと通常よりもデフォルトです。

私は修理の設置VS2013って再インストールを更新1かいてアップデートされたすべてのNugetパッケージソリューションとなります。

思い出のアイデアです。

更新1 考えることに関係している可能性を自分のPCかに展開、ウェブサイトはAzure、まだまだ問題が根強い。ということに関連している可能性があるから組立まで報告されているを確認してください。◆思いfusionlogが見えないとの結合が予想される。

紡績新しいVM内のクリーンのインストールWindows8VS2013見出すことができれば新しいプロジェクトが活動しています。

更新2 Okったエドワード-スノーデン"ネットワーク"の撮影において、ユーザーを選択し、外部プロバイダではポストにExternalLogin行動が、対応は401不正.どんなことが原因でしょうか?

役に立ちましたか?

解決

Ok

きっかけになるかもしれないと何に重要な部分)に発行しました。

まず、今でもな理由を制作する場合は、MVCプロジェクトったり下がったりよくわからない足場を投稿内容の投稿者にAccountControllerクラスです。

しかし、そうで私は自分のログインボタンの後ろに去っていく"google"の代わりに"Google"としてのプロバイダです。

真剣に!?私はちょっと驚きるケーシングのように名前のプロバイダーがあります。

他のヒント

こんなに不明な点があれば、ここでお答えがでの対応は非常に類似の問題

またOwin2.0いへの移行2.1

の_ExternalLoginsListPartial変更する必要から:

<button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="Partner" value="@p.AuthenticationType" title="Log in using your @p.Caption account">@p.AuthenticationType</button>

この

<button type="submit" class="btn btn-default" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">@p.AuthenticationType</button>

この変更にボタンのものが頭のような鉱山とコストの2日間の作業の問題です。

ることを説明し、新Owin版でない場合には必ず何かを指定都.

いたるとともに、同誌掲載号の注目もASP.Net WebAPIです。私は正しいAuthenticationTypeへの挑戦法にも空白のページです。

が発行した順に加え、OAuthによる提供者へのOWINパイプラインで起動します。約っ順:

        app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
        OAuthBearerOptions = new OAuthBearerAuthenticationOptions();

        var authServerOptions = new OAuthAuthorizationServerOptions
        {
        ...
        };

        // Token Generation
        app.UseOAuthAuthorizationServer(authServerOptions);
        app.UseOAuthBearerAuthentication(OAuthBearerOptions);

        // Configure Google External Login
        GoogleAuthOptions = new GoogleOAuth2AuthenticationOptions()
        {
            ClientId = xxxx,
            ClientSecret = xxxx,
            Provider = new GoogleAuthProvider()
        };
        app.UseGoogleAuthentication(GoogleAuthOptions);

        app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
        app.UseWebApi(config);

た追加のUseCors+UseWebApi方法UseGoogleAuthentication方法です。

この投稿に役立つもの:http://coding.abel.nu/2014/06/understanding-the-owin-external-authentication-pipeline/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top