From 29b4a7f4e77733ce19729d632f76706ed0475448 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Sun, 7 Feb 2016 09:32:35 -0500 Subject: [PATCH] Remove Twitter module - Twitter does not support OAuth 2[1] The motivating issue was created without realizing this (it is a bit surprising), and the module that was committed doesn't appear to work. - For OAuth 1, support[2] already exists Fixes #25 [1]: https://twittercommunity.com/t/oauth-2-0-support/253 [2]: http://hackage.haskell.org/package/yesod-auth-oauth-1.4.0.2/docs/Yesod-Auth-OAuth.html --- Yesod/Auth/OAuth2/Twitter.hs | 53 ------------------------------------ yesod-auth-oauth2.cabal | 1 - 2 files changed, 54 deletions(-) delete mode 100644 Yesod/Auth/OAuth2/Twitter.hs diff --git a/Yesod/Auth/OAuth2/Twitter.hs b/Yesod/Auth/OAuth2/Twitter.hs deleted file mode 100644 index 9168fac..0000000 --- a/Yesod/Auth/OAuth2/Twitter.hs +++ /dev/null @@ -1,53 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE OverloadedStrings #-} -module Yesod.Auth.OAuth2.Twitter - ( oauth2Twitter - , module Yesod.Auth.OAuth2 - ) where - -#if __GLASGOW_HASKELL__ < 710 -import Control.Applicative ((<$>), (<*>)) -#endif - -import Control.Monad (mzero) -import Data.Aeson -import Data.Text (Text) -import Data.Text.Encoding (encodeUtf8) -import Yesod.Auth -import Yesod.Auth.OAuth2 - -data TwitterUser = TwitterUser - { twitterUserId :: Text - , twitterUserName :: Text - , twitterScreenName :: Text - } - -instance FromJSON TwitterUser where - parseJSON (Object o) = TwitterUser - <$> o .: "id_str" - <*> o .: "name" - <*> o .: "screen_name" - - parseJSON _ = mzero - -oauth2Twitter :: YesodAuth m - => Text -- ^ Client ID - -> Text -- ^ Client Secret - -> AuthPlugin m -oauth2Twitter clientId clientSecret = authOAuth2 "twitter" - OAuth2 - { oauthClientId = encodeUtf8 clientId - , oauthClientSecret = encodeUtf8 clientSecret - , oauthOAuthorizeEndpoint = "https://api.twitter.com/oauth/authorize" - , oauthAccessTokenEndpoint = "https://api.twitter.com/oauth/access_token" - , oauthCallback = Nothing - } - $ fromProfileURL "twitter" "https://api.twitter.com/1.1/account/verify_credentials.json" - $ \user -> Creds - { credsPlugin = "twitter" - , credsIdent = twitterUserId user - , credsExtra = - [ ("name", twitterUserName user) - , ("screen_name", twitterScreenName user) - ] - } diff --git a/yesod-auth-oauth2.cabal b/yesod-auth-oauth2.cabal index 126232b..de7414e 100644 --- a/yesod-auth-oauth2.cabal +++ b/yesod-auth-oauth2.cabal @@ -43,7 +43,6 @@ library Yesod.Auth.OAuth2.Github Yesod.Auth.OAuth2.Google Yesod.Auth.OAuth2.Spotify - Yesod.Auth.OAuth2.Twitter Yesod.Auth.OAuth2.Upcase Yesod.Auth.OAuth2.EveOnline Yesod.Auth.OAuth2.Nylas