Skip to content

Instantly share code, notes, and snippets.

@jedisct1
Created March 15, 2011 13:01
Show Gist options
  • Save jedisct1/870685 to your computer and use it in GitHub Desktop.
Save jedisct1/870685 to your computer and use it in GitHub Desktop.
Twitter API with OAuth2
Browse:
https://oauth.twitter.com/2/authorize?oauth_callback_url=http://www.example.com/&oauth_mode=flow_web_client&oauth_client_identifier=7ynojZQ3uVE2DifWftbS3w
After authentication, user gets redirected to:
http://www.example.com/#oauth_access_token=RnEJAQAAAABpYH8NAAAAAGKSBQAAAAAAr9G2hLrnXaznri8LlSIaR0HuNBI=HLx1r47oqpobPncAm9DNeRCdySaMqoTKJcCLwnhIP&oauth_bridge_code=2wxWDd3IIZ0UW1y4oFpioWfbzTeaAlSGoJk5L6qMpGQ
...Use the API:
$ curl -d 'screen_name=jedisct1&text=test+twitter+oauth2&oauth_access_token=RnEJAQAAAABpYH8NAAAAAGKSBQAAAAAAr9G2hLrnXaznri8LlSIaR0HuNBI=HLx1r47oqpobPncAm9DNeRCdySaMqoTKJcCLwnhIP' https://api.twitter.com/direct_messages/new.json
@carviaso
Copy link

carviaso commented Mar 8, 2019

Hi, how are obtain the user information?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment