我需要在两个不同的浏览器(即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"/>
答案 0 :(得分:4)
您需要使用为该用户获取的oauth令牌映射openid,并将其保存在商店中。用户下次登录时,应在应用程序中构建逻辑,以查找该用户的令牌(基于openid)。