title: How to logout FaceBook in window phone 7
body: <p>I have a problem logging out of Facebook on Windows Phone. I have the code to login, but I can't log out of it. Can someone show me how to log out of Facebook on a Windows Phone?</p>
  
  <p>Here's the login code:</p>
  
  <pre><code>private FacebookClient _asyncFbClient;
          private string _appID = "";
          private string _appSecret = "";
  
          private void StartFacebookLogin(object sender, RoutedEventArgs e)
          {
              string[] extendedPermissions = new[] { "user_about_me", "publish_stream", "email" };
              FacebookClient fb = new FacebookClient();
  
              var oauth = new FacebookOAuthClient { AppId = _appID, AppSecret = _appSecret };
              var logout = new FacebookUser();
  
              var parameters = new Dictionary&lt;string, object&gt;
                              {
                                  {"response_type", "token"},
                                  {"display", "touch"}                                        
                              };
              if (extendedPermissions != null &amp;&amp; extendedPermissions.Length &gt; 0)
              {
                  var scope = new StringBuilder();
                  scope.Append(string.Join(",", extendedPermissions));
                  parameters["scope"] = scope.ToString();
              }
  
              var loginUrl = oauth.GetLoginUrl(parameters);
              webBrowser.Navigated += new EventHandler&lt;System.Windows.Navigation.NavigationEventArgs&gt;(CheckForAuth);
              webBrowser.Navigate(loginUrl);
  
          }
  
          private void CheckForAuth(object sender, System.Windows.Navigation.NavigationEventArgs e)
          {
              FacebookOAuthResult result;
              if (FacebookOAuthResult.TryParse(e.Uri, out result))
              {
                  if (result.IsSuccess)
                  {
                      IsolatedStorageSettings Settings = IsolatedStorageSettings.ApplicationSettings;
                      MessageBox.Show(result.AccessToken);
                      access = result.AccessToken;
                      if (Settings.Contains("MyFacebookAccessToken1"))
                          Settings["MyFacebookAccessToken1"] = result.AccessToken;
                      else
                          Settings.Add("MyFacebookAccessToken1", result.AccessToken);
                      Settings.Save();
                      _asyncFbClient = new FacebookClient(result.AccessToken);
  
                      _asyncFbClient.GetCompleted += new EventHandler&lt;FacebookApiEventArgs&gt;(_asyncFbClient_GetCompleted);
                      _asyncFbClient.GetAsync("/me");
  
                  }
              }
          }
  </code></pre>
  
  <p>Here's the logout code:</p>
  
  <pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(linkUrl);
              request.Method = "GET";
              request.BeginGetResponse(new AsyncCallback(LogoutResponse), request);
  private void LogoutResponse(IAsyncResult result)
          {
              string responseData = "";
              try
              {
                  HttpWebRequest request = result.AsyncState as HttpWebRequest;
                  HttpWebResponse response = request.EndGetResponse(result) as HttpWebResponse;
                  if (response != null &amp;&amp; response.StatusCode == HttpStatusCode.OK)
                  {
                      Stream stream = response.GetResponseStream();
                      StreamReader reader = new StreamReader(stream);
                      responseData = reader.ReadToEnd();
                      //responseData = true
                  }
              }
              catch (Exception ex)
              {
                  Dispatcher.BeginInvoke(() =&gt; { MessageBox.Show(ex.Message); });
              }
          }
  </code></pre>
  
  <p>I have tried to use Facebook's logout API and get a successful result, but the next time I open the web browser it's already automatically logged in to Facebook again. How can I get it to log out?</p>