这是 IdentityServer3 的不错教程,包括 GOOGLE+ 登录
https://identityserver.github.io/Documentation/docs/overview/mvcGettingStarted.html
var google = new GoogleOAuth2AuthenticationOptions
{
AuthenticationType = "Google",
Caption = "Google",
SignInAsAuthenticationType = signInAsType,
ClientId = "xxxxx-8boio83mb57ruogr9af9ut09fkg56b27.apps.googleusercontent.com",
ClientSecret = "5fWcBT0udKY7_b6E3gEiJlze"
};
app.UseGoogleAuthentication(google);
var fb = new FacebookAuthenticationOptions
{
AuthenticationType = "Facebook",
Caption = "Facebook",
SignInAsAuthenticationType = signInAsType,
AppId = "xxxxxxx",
AppSecret = "9d6ab75f921942e61fb43a9b1fc25c63"
};
app.UseFacebookAuthentication(fb);
问题是当我点击 GOOGLE+ 时,我得到了访问令牌,但这个令牌对 google api 无效。我无法取回对 Google+ API 有效的令牌,以便我可以取回所有 UserData。
FB也有同样的问题
这可能吗?