OpenId - how to use checkid_immediate and x-has-session?
The documentation doesn't tell much about those two parameters. I understand they somehow related to log in status checking.
I want to check if a user is currently logged in the browser (Meaning, signed in with google, and checked "keep me logged in" )
I want to be able to differentiate between to states :
- A user is logged in the browser (meaning, signed in with Google for example, and check "Keep me logged in") and that user already approved my app. 
- Any other state. (user is not logged in . user logged in but with an identity he didn't approved yet... etc.) 
If I know I am in the first state, I don't need to "show" the popup (I give it top=9999 left=9999)
I am trying to figure out the two states with this code. This needs to be done without any user interaction or any visual cue.
public partial class WebForm1 : System.Web.UI.Page
    {
        protected string Url { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            var parameters = new Dictionary<string, string>();
            parameters.Add("openid.ns", "http://specs.openid.net/auth/2.0");
            parameters.Add("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select");
            parameters.Add("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select");
            parameters.Add("openid.return_to", "http://localhost:17556/redirect.aspx");
            parameters.Add("openid.realm", "http://localhost:17556/");
            parameters.Add("openid.mode", "checkid_immediate");
            parameters.Add("openid.ns.ax", "http://openid.net/srv/ax/1.0");
            parameters.Add("openid.ax.mode", "fetch_request");
            parameters.Add("openid.ax.type.email", "http://axschema.org/contact/email");
            parameters.Add("openid.ax.required", "email");
            parameters.Add("openid.ns.ui", "http://specs.openid.net/extensions/ui/1.0"开发者_JAVA百科);
            parameters.Add("openid.ui.mode", "x-has-session");
            string OpenIdEndpoint = https://www.google.com/accounts/o8/ud;
            var url = CreateUrlRequest(OpenIdEndpoint, parameters);
            WebClient wc = new WebClient();
            var res = wc.UploadString(url, "");
        }
        public string CreateUrlRequest(string i_Url, Dictionary<string, string> i_Parameters)
        {
            return string.Format("{0}?{1}", i_Url, string.Join("&", i_Parameters.Select(kvp => string.Format("{0}={1}", kvp.Key, kvp.Value)).ToList()));
        }
    } 
running this code, a callback is sent to redirect.aspx, but the query string doesn't have any information about the states I am interested in. It contains openid.mode=setup_needed among other things.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论