Skip to content

A simple Python Flask web app that demonstrates the flow of obtaining a Twitter user OAuth access token

License

Notifications You must be signed in to change notification settings

Jxck-S/twauth-web

 
 

Repository files navigation

twauth-web

Setup

  1. Obtain consumer key and secret from the Twitter Developer portal. The app should be configured to enable Sign in with Twitter. See twauth-web.py for more details, but you can either:

    1. add these values to a config.cfg file (local deployment); or
    2. set environment variables TWAUTH_APP_CONSUMER_KEY and TWAUTH_APP_CONSUMER_SECRET (cloud deployment)
  2. Setup a pipenv environment, and install dependencies:

    1. pipenv install
    2. pipenv shell
  3. Start the app:

    1. python3 ./twauth-web.py; or
    2. gunicorn twauth-web:app
  4. Make the site externally accessible port forward, or run a tunnel e.g. ngrok for local use, or deploy to a cloud platform such as Heroku (a Procfile is included), accessing local host will not work.

  5. Goto the dev portal and go to your app and add your app's callback URL (https://your-deployed-url/callback) to the callback URL whitelist setting.

  6. Go to your deployed URL and sign in your user tokens will be returned for the signed in user to use this app.

Reference

Twitter Developer Portal
Flask
python-oauth2
Bootstrap

Credits

Original version by Jacob Petrie
https://twitter.com/jaakkosf
https://github.com/jaakko-sf/twauth-web

About

A simple Python Flask web app that demonstrates the flow of obtaining a Twitter user OAuth access token

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 52.8%
  • Python 47.2%