2013-07-11 67 views
0

我需要使用彈出窗口進行Google OAuth身份驗證。我正在使用DotNetOpenAuth庫進行身份驗證,並且它在同一頁面上工作。我怎樣才能在彈出窗口上做到這一點。我用google搜索了一下,我發現其中有一些是「Specify request parameters in dotnetopenauth 4」但我使用這個庫的方式我不知道我可以在哪裏設置彈出窗口。在ASP.Net中使用彈出窗口的DotNetOpenAuth OAuth授權

這是我的代碼。

私人字符串AccessToken {{0}} {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)?由於

回答