Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

provides a public logout function to ensure a user gets logged out of fa... #2

Closed
wants to merge 1 commit into from

3 participants

Mike Sherov Thomas Wunderlich antoineguiral
Mike Sherov

...cebook and the connected website.

Mike Sherov

I signed the document listed here: https://developers.facebook.com/opensource/cla

Thomas Wunderlich

There's already a login/logout function, take a look at example.php

Mike Sherov

@ThomasWunderlich that doesn't also clear the session data in PHP. If the user has granted offline_access (which I know is now deprecated), they aren't really ever logged out. Try it.

The correct way to log someone out fully is remove the session data from your own server, then direct the user to logout of facebook as well.

antoineguiral

and remove the cookie too, no?

uestla uestla referenced this pull request from a commit
uestla uestla coding standards #2 e3bfd3e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 08, 2012
Mike Sherov mikesherov provides a public logout function to ensure a user gets logged out of…
… facebook and the connected website.
e04c3ad
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 15 additions and 0 deletions. Show diff stats Hide diff stats

  1. +15 0 src/base_facebook.php
15 src/base_facebook.php
@@ -527,6 +527,21 @@ public function getLogoutUrl($params=array()) {
527 527 }
528 528
529 529 /**
  530 + * Clear all data from the persistent storage
  531 + * and then redirect the user to log out of Facebook as well.
  532 + *
  533 + * The parameters:
  534 + * - next: the url to go to after a successful logout
  535 + *
  536 + * @param array $params Provide custom parameters
  537 + */
  538 + public function logout($params=array()) {
  539 + $this->clearAllPersistentData();
  540 + header('Location: ' . $this->getLogoutUrl($params));
  541 + die();
  542 + }
  543 +
  544 + /**
530 545 * Get a login status URL to fetch the status from Facebook.
531 546 *
532 547 * The parameters:

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.