From 2df6650172ff5aa805248d5c95fdc769dccf2c7b Mon Sep 17 00:00:00 2001 From: Felipe Lessa Date: Mon, 19 Dec 2011 09:49:11 -0200 Subject: [PATCH] Add getLogoutUrl to Facebook. --- Web/Authenticate/Facebook.hs | 10 ++++++++++ authenticate.cabal | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Web/Authenticate/Facebook.hs b/Web/Authenticate/Facebook.hs index 13b68238..bb9fd4a9 100644 --- a/Web/Authenticate/Facebook.hs +++ b/Web/Authenticate/Facebook.hs @@ -10,6 +10,7 @@ module Web.Authenticate.Facebook , getAccessToken , getGraphData , getGraphData_ + , getLogoutUrl ) where import Network.HTTP.Enumerator @@ -103,3 +104,12 @@ getGraphData_ a b = getGraphData a b >>= either (throwIO . InvalidJsonException) data InvalidJsonException = InvalidJsonException String deriving (Show, Typeable) instance Exception InvalidJsonException + +-- | Logs out the user from their Facebook session. +getLogoutUrl :: AccessToken + -> Text -- ^ URL the user should be directed to in your site domain. + -> Text -- ^ Logout URL in @https://www.facebook.com/@. +getLogoutUrl (AccessToken s) next = + TE.decodeUtf8 $ toByteString $ + copyByteString "https://www.facebook.com/logout.php" + `mappend` renderQueryText True [("next", Just next), ("access_token", Just s)] diff --git a/authenticate.cabal b/authenticate.cabal index be5dda31..882ecee2 100644 --- a/authenticate.cabal +++ b/authenticate.cabal @@ -1,5 +1,5 @@ name: authenticate -version: 0.10.3.1 +version: 0.10.4 license: BSD3 license-file: LICENSE author: Michael Snoyman, Hiromi Ishii, Arash Rouhani