Twitter OAuth and API access with Haskell
Haskell Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

twitter oauth using haskell

Experimenting with Haskell and Twitter OAuth/API

twitter.cfg is the necessary config file with creds:

  key = yourkey
  secret =  yoursecret
  callback = http://localhost:3000/sign-in-with-twitter

Documentation is not complete


Wire up Snap app with this function

-- | Injects the oauth_verifier into the token. Usually this means the user has 
-- authorized the app to access his data.

injectOAuthVerifier :: String -> Token -> Token
injectOAuthVerifier value (ReqToken app params) = ReqToken app (replace ("oauth_verifier",value) params)
injectOAuthVerifier _ token                     = token

Twitter verifier looks like this

GET /local-endpoint-sign-in-with-twitter/?
        oauth_verifier=uw7NjWHT6OJ1MpJOXsHfNxoAhPKpgI8BlYDhxEjIBY HTTP/1.1

Remember that I can get Token fieldlist with (oauthParams token)

Source code for Network.OAuth.Consumer (hauth-0.2.5)

TODO Switch from Data.ConfigFile to Data.Configurator


I started with this gist from mlikka && updated and modified it