parent
074b0c68e7
commit
8a66da1f24
@ -5,7 +5,6 @@ module Yesod.Auth.OAuth
|
|||||||
, oauthUrl
|
, oauthUrl
|
||||||
, authTwitter
|
, authTwitter
|
||||||
, twitterUrl
|
, twitterUrl
|
||||||
, twitterId
|
|
||||||
, authTumblr
|
, authTumblr
|
||||||
, tumblrUrl
|
, tumblrUrl
|
||||||
, module Web.Authenticate.OAuth
|
, module Web.Authenticate.OAuth
|
||||||
@ -109,25 +108,6 @@ authTwitter key secret = authOAuth
|
|||||||
twitterUrl :: AuthRoute
|
twitterUrl :: AuthRoute
|
||||||
twitterUrl = oauthUrl "twitter"
|
twitterUrl = oauthUrl "twitter"
|
||||||
|
|
||||||
-- | Gets Twitter ID (/user_id/) from @Creds@.
|
|
||||||
--
|
|
||||||
-- Never use @credsIdent@ for Twitter OAuth. @credsIdent@ returns /screen_name/, which shouldn't be used for authentication.
|
|
||||||
-- /screen_name/ is text like /foo/ of /\@foo/ which is unique but __mutable__. So /screen_name/ cannot authenticate users.
|
|
||||||
-- /user_id/ is integer which is unique and __immutable__. So you should use this for authentication.
|
|
||||||
--
|
|
||||||
-- Because of compatibility, @credsIdent@ returns /screen_name/ yet.
|
|
||||||
--
|
|
||||||
-- Since 1.4.x.x
|
|
||||||
twitterId :: Yesod m => Creds m -> Text
|
|
||||||
twitterId creds =
|
|
||||||
let
|
|
||||||
key = "user_id"
|
|
||||||
extra = credsExtra creds
|
|
||||||
in
|
|
||||||
case lookup key extra of
|
|
||||||
Just uId -> uId
|
|
||||||
Nothing -> throw $ CredentialError ("key not found: " ++ (T.unpack key)) (Credential $ map (encodeUtf8 *** encodeUtf8) extra)
|
|
||||||
|
|
||||||
authTumblr :: YesodAuth m
|
authTumblr :: YesodAuth m
|
||||||
=> ByteString -- ^ Consumer Key
|
=> ByteString -- ^ Consumer Key
|
||||||
-> ByteString -- ^ Consumer Secret
|
-> ByteString -- ^ Consumer Secret
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user