Added getTokenCredential = getAccessToken

This commit is contained in:
Michael Snoyman 2011-03-09 17:53:59 +02:00
parent 4d87d3b2c6
commit 0b09a4f66b
2 changed files with 7 additions and 3 deletions

View File

@ -8,7 +8,8 @@ module Web.Authenticate.OAuth
-- * Signature -- * Signature
signOAuth, signOAuth,
-- * Url & operation for authentication -- * Url & operation for authentication
authorizeUrl, getAccessToken, getTemporaryCredential, authorizeUrl, getAccessToken, getTemporaryCredential,
getTokenCredential,
-- * Utility Methods -- * Utility Methods
paramEncode paramEncode
) where ) where
@ -97,7 +98,8 @@ authorizeUrl :: OAuth -- ^ OAuth Application
authorizeUrl oa cr = qsUrl (oauthAuthorizeUri oa) [("oauth_token", BS.unpack $ token cr)] authorizeUrl oa cr = qsUrl (oauthAuthorizeUri oa) [("oauth_token", BS.unpack $ token cr)]
-- | Get Access token. -- | Get Access token.
getAccessToken :: OAuth -- ^ OAuth Application getAccessToken, getTokenCredential
:: OAuth -- ^ OAuth Application
-> Credential -- ^ Temporary Credential with oauth_verifier -> Credential -- ^ Temporary Credential with oauth_verifier
-> IO Credential -- ^ Token Credential (Access Token & Secret) -> IO Credential -- ^ Token Credential (Access Token & Secret)
getAccessToken oa cr = do getAccessToken oa cr = do
@ -106,6 +108,8 @@ getAccessToken oa cr = do
let dic = parseQueryString . toStrict . responseBody $ rsp let dic = parseQueryString . toStrict . responseBody $ rsp
return $ Credential dic return $ Credential dic
getTokenCredential = getAccessToken
insertMap :: Eq a => a -> b -> [(a,b)] -> [(a,b)] insertMap :: Eq a => a -> b -> [(a,b)] -> [(a,b)]
insertMap key val = ((key,val):) . filter ((/=key).fst) insertMap key val = ((key,val):) . filter ((/=key).fst)

View File

@ -1,5 +1,5 @@
name: authenticate name: authenticate
version: 0.8.1 version: 0.8.2
license: BSD3 license: BSD3
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>