private session_info GetSession(string auth_token, bool isAsync, GetSessionCallback callback, Object state) { var parameterList = new Dictionary <string, string> { { "method", "facebook.auth.getSession" }, { "auth_token", auth_token } }; if (isAsync) { SendRequestAsync(parameterList, false, new FacebookCallCompleted <auth_getSession_response>(callback), state); return(null); } return(SendRequest <auth_getSession_response>(parameterList, false)); }
private session_info GetSession(string auth_token, bool isAsync, GetSessionCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.auth.getSession" }, { "auth_token", auth_token } }; if (isAsync) { SendRequestAsync(parameterList, false, new FacebookCallCompleted<auth_getSession_response>(callback), state); return null; } return SendRequest<auth_getSession_response>(parameterList, false); }
/// <summary> /// Returns the session key bound to an auth_token, as returned by CreateToken or in the callback URL. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// /// // Create auth token (using synchronous for sample brevity only) /// var token = api.Auth.CreateToken(); /// /// // Note user must be navigated to Facebook login.php to validate token /// const string facebookLoginUrl = "https://login.facebook.com/login.php?api_key={0}&auth_token={1}&v=1.0&popup"; /// var loginurl = String.Format(facebookLoginUrl, Constants.WebApplicationKey, token); /// System.Diagnostics.Process.Start(loginurl); /// /// // After login.php visited and /// api.Auth.GetSessionAsync(token, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(session_info result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="authToken">Token retrieved from prev CreateToken call</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>If the user has successfully logged in, this will return valid values for each field. The expires element is a Unix time that indicates when the given session will expire. If the value is 0, the session will never expire. See the authentication guide for more information.</returns> public void GetSessionAsync(string authToken, GetSessionCallback callback, Object state) { GetSession(authToken, true, callback, state); }