Skip to content

Instantly share code, notes, and snippets.

@yortz
Last active December 19, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yortz/5867564 to your computer and use it in GitHub Desktop.
Save yortz/5867564 to your computer and use it in GitHub Desktop.
defmodule Twitter do
def get_oauth_token
consumer_key= "yourkey"
consumer_secret = "yoursecret"
url = 'https://api.twitter.com/oauth'
consumer = Oauthex.Consumer.new(
key: :erlang.binary_to_list(consumer_key),
secret: :erlang.binary_to_list(consumer_secret)
)
reqinfo = Oauthex.request_token '#{url}/request_token', [], consumer
IO.puts '''
You secret is: #{reqinfo.secret}
Your auth url is:
#{url}/authenticate?oauth_token=#{reqinfo.token}
'''
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment