我需要使用弹出窗口进行Google OAuth身份验证。我正在使用DotNetOpenAuth库进行身份验证,它在同一页面上工作。我怎么能在弹出窗口上做到这一点。我在谷歌上搜索了一下,发现了一些,其中一个是"在dotnetopenauth 4中指定请求参数",但我使用这个库的方式,我不知道在哪里可以设置弹出窗口。
这是我的密码。
专用字符串AccessToken{get{return(string)Session["GoogleAccessToken"];}set{Session["GoogleAccessToken"]=value;}}
private static readonly GoogleClient googleClient = new GoogleClient
{
ClientIdentifier = ConfigurationManager.AppSettings["googleConsumerKey"],
ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(ConfigurationManager.AppSettings["googleConsumerSecret"]),
};
protected void Page_Load(object sender, EventArgs e)
{
if (googleClient != null)
{
if (!IsPostBack)
{
var authorization = googleClient.ProcessUserAuthorization();
if (authorization != null)
{
this.AccessToken = authorization.AccessToken;
}
else if (this.AccessToken == null)
{
googleClient.RequestUserAuthorization(scope: new[] { GoogleClient.Scopes.WebMaster.SiteVerification, GoogleClient.Scopes.WebMaster.WebMasterTools });
}
}
}
}
private static readonly AuthorizationServerDescription GoogleDescription = new AuthorizationServerDescription {
TokenEndpoint = new Uri("https://accounts.google.com/o/oauth2/token"),
AuthorizationEndpoint = new Uri("https://accounts.google.com/o/oauth2/auth"),
ProtocolVersion = ProtocolVersion.V20,
};
你能帮我一下吗(我是ASP.Net的新手)?感谢
如果您想要一个支持客户端工具的库,包括单击按钮后打开弹出窗口,您可能需要查看javascript API:
https://developers.google.com/api-client-library/javascript/features/authentication