Giter Club home page Giter Club logo

twauth-web's Introduction

twauth-web

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

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

Note: the app must have an Internet-accessible URL - do not attempt to connect via localhost, as this will not work. You can run a tunnel e.g. ngrok for local use, or deploy to a cloud platform such as Heroku (a Procfile is included).

Open a browser window on your demo app's external URL. Don't click the buttons yet!

Finally, revisit the dev portal, and add your app's callback URL (https://your-deployed-url/callback) to the callback URL whitelist setting. Once saved, follow the instructions on the app's web UI to click through the demo pages.

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

twauth-web's People

Contributors

jaakko-sf avatar andypiper avatar xm94 avatar adityaoli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.