private string CreateToken(bool isAsync, CreateTokenCallback callback, Object state) { var parameterList = new Dictionary <string, string> { { "method", "facebook.auth.createToken" } }; if (isAsync) { SendRequestAsync <auth_createToken_response, string>(parameterList, false, new FacebookCallCompleted <string>(callback), state); return(null); } var response = SendRequest <auth_createToken_response>(parameterList, false); return(response == null ? null : response.TypedValue); }
private string CreateToken(bool isAsync, CreateTokenCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.auth.createToken" } }; if(isAsync) { SendRequestAsync<auth_createToken_response, string>(parameterList, false, new FacebookCallCompleted<string>(callback), state); return null; } var response = SendRequest<auth_createToken_response>(parameterList, false); return response == null ? null : response.TypedValue; }
/// <summary> /// Creates an auth_token to be passed in as a parameter to GetSession after the user has logged in. /// (Intended for desktop applications only) /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey)); /// api.Auth.CreateTokenAsync(AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(string result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>This method creates an auth_token to be passed in as a parameter to Facebook Login url and then to Auth.GetSession after the user has logged in.</returns> public void CreateTokenAsync(CreateTokenCallback callback, Object state) { CreateToken(true, callback, state); }
/// <summary> /// Creates an auth_token to be passed in as a parameter to GetSession after the user has logged in. /// (Intended for desktop applications only) /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey)); /// api.Auth.CreateTokenAsync(AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(string result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>This method creates an auth_token to be passed in as a parameter to Facebook Login url and then to Auth.GetSession after the user has logged in.</returns> public void CreateTokenAsync(CreateTokenCallback callback, Object state) { CreateToken(true, callback, state); }