Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A simple Flask extension implementing Olin's authentication

Project description

Flask-OlinAuth implements OlinApps auth. It automatically provides a /olinauthlogin and /olinauthlogout route to the application, handling the process of actually authenticating a user with olinapps.

At a high level, Flask-OlinAuth provides two useful pieces for your application, both of which are demonstrated in


A simple function decorator which ensures that a user is logged in before a view is shown. The user is redirected to the login portal, with correct arguments, if not.


A nice local proxy for all of your views to get the current user, formatted as a dictionary.


Will log out the currently authenticated user, allowing you to simply create your own logout view.

Flask-OlinAuth is very heavily inspired by Flask-Login, with structure, and functionality adopted, and much knowledge gained.


Install the extension with one of the following commands:

$ easy_install flask-olinauth

or alternatively if you have pip installed (which you should):

$ pip install flask-olinauth

Example Usage

from flask import Flask, url_for
from flask.ext.olinauth import OlinAuth, auth_required, current_user
app = Flask(__name__)

SECRET_KEY = "yeah, not actually a secret"
DEBUG = True


oa = OlinAuth(app, 'localhost:5000')
#initial OlinAuth, with callback host of localhost:5000, for local server
oa.init_app(app, 'localhost:5000')

def index():
    if current_user:
        responseString = "Awesome index, guess what? %s is logged in. Sweet, right?" % current_user['id']
        responseString = "<html>It is kind of lonely here... No users are logged in. <a href=%s>Checkout my secret</a> </html>" % url_for('secret')
    return responseString

def secret():
    return "I wouldn't normally show you this, but since %s is logged in, here is the secret: 42" % current_user['id']

if __name__ == "__main__":

Project details

Release history Release notifications

This version
History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
Flask-OlinAuth-1.0.1.win32.exe (203.5 kB) Copy SHA256 hash SHA256 Windows Installer any Feb 5, 2013 (8.3 kB) Copy SHA256 hash SHA256 Source None Feb 5, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page