Skip to content

Latest commit

 

History

History

038

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

038

Snippet to add Twitter login to your Flask app. Basically I got this working (myreadinglist app) and adapted it slightly when testing.

### Steps

  • Create Twitter app, see printscreen below, note the Callback URL.

  • Note down consumer_key and consumer_secret

  • Set env vars (and/or persist them in your .bashrc):

      $ export PYB_100D_TW_KEY=abc
      $ export PYB_100D_TW_SECRET=def
      $ export PYB_100D_APP_SECRET=ghi
    
  • Start app:

      $ python app.py
    

Demo

Create app:

twitter login 1

Login:

twitter login 2

Twitter asks you to authorize the app:

twitter login 3

Logout:

twitter login 4

TODO

Do actual stuff with Twitter API (load feed, post, etc)