MVC Oauth2访问Google Analytics

时间:2014-12-29 19:52:45

标签: asp.net-mvc google-analytics oauth-2.0 google-analytics-api

我已经设置了我的asp.net MVC网站,允许通过Google登录:

App_Start \ Startup.Auth.cs

var googlePlusOptions = new Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationOptions
        {
            ClientId = "someid",
            ClientSecret = "somesecret",
            SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
        };
        googlePlusOptions.Scope.Add("email");
        googlePlusOptions.Scope.Add("https://www.googleapis.com/auth/analytics.readonly");

        app.UseGoogleAuthentication(googlePlusOptions);

我以为我会在声明列表中看到授权代码,但那里什么都没有。我从哪里获得授权代码?任何教程或帮助将不胜感激,我是MVC,OAuth和Google API的新手,并且感觉有点过头了。

0 个答案:

没有答案