我需要在两个不同的浏览器(即 Chrome 和 IE)之间维护一个 OpenID 登录。如何才能做到这一点?
我正在使用这段代码:
这是我的代码:
/// <summary>
/// Action Result for Index, This flow will create OAuthConsumer Context using Consumer key and Consuler Secret key
/// obtained when Application is added at intuit workspace. It creates OAuth Session out of OAuthConsumer and Calls
/// Intuit Workpsace endpoint for OAuth.
/// </summary>
/// <returns>Redirect Result.</returns>
public RedirectResult Index()
{
oauth_callback_url = Request.Url.GetLeftPart(UriPartial.Authority) + ConfigurationManager.AppSettings["oauth_callback_url"];
consumerKey = ConfigurationManager.AppSettings["consumerKey"];
consumerSecret = ConfigurationManager.AppSettings["consumerSecret"];
oauthLink = Constants.OauthEndPoints.IdFedOAuthBaseUrl;
IToken token = (IToken)Session["requestToken"];
IOAuthSession session = CreateSession();
IToken requestToken = session.GetRequestToken();
Session["requestToken"] = requestToken;
RequestToken = requestToken.Token;
TokenSecret = requestToken.TokenSecret;
oauthLink = Constants.OauthEndPoints.AuthorizeUrl + "?oauth_token=" + RequestToken + "&oauth_callback=" + UriUtility.UrlEncode(oauth_callback_url);
return Redirect(oauthLink);
}
<add key="webpages:Version" value="1.0.0.0"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<add key="oauth_callback_url" value="/OauthResponse"/>
<add key="menuProxy" value="MenuProxy"/>
<add key="grantUrl" value="OauthGrant"/>
<add key="qbo_base_url" value="https://qbo.intuit.com/qbo1/rest/user/v2/"/>
<!-- Enter the Application Name by replacing YourAppName -->
<add key="openid_identifier" value="https://openid.intuit.com/Identity-YourAppName"/>