Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Registration and authorization (including social) for aiohttp apps

Project Description

Registration and authorization (including social) for aiohttp apps

With just a few settings you’ll give for your aiohttp site:

  • registration with email confirmation
  • authorization by email or social account (facebook, google and vkontakte for now)
  • reset password by email
  • change email with confirmation
  • edit current password

You can see all of this staff alive here


You can use this lib with different database backends:

  • postgres with asyncpg
  • mongodb with motor
  • the db you need - it’s very easy to add a new backend

UI themes

The library designed to easily change UI themes. Currently bootstrap-3 and bootstrap-4 themes are available. But it’s very easy to add new themes, actually theme - is just a folder with jinja2 templates.

Installation and configuration

Just install the library from pypi:

pip install aiohttp-login

Choice and configure one of database storages.

For postgres with asyncpg:

import asyncpg
from aiohttp_login.asyncpg_storage import AsyncpgStorage

pool = await asyncpg.create_pool(dsn='postgres:///your_db')
storage = AsyncpgStorage(pool)

For mongodb with motor:

from motor.motor_asyncio import AsyncIOMotorClient
from aiohttp_login.motor_storage import MotorStorage

db = AsyncIOMotorClient(io_loop=loop)['your_db']
storage = MotorStorage(db)

Now configure the library with a few settings:

app = web.Application(loop=loop)
aiohttp_login.setup(app, storage, {
    'CSRF_SECRET': 'secret',

    'VKONTAKTE_ID': 'your-id',
    'VKONTAKTE_SECRET': 'your-secret',
    'GOOGLE_ID': 'your-id',
    'GOOGLE_SECRET': 'your-secret',
    'FACEBOOK_ID': 'your-id',
    'FACEBOOK_SECRET': 'your-secret',

    'SMTP_SENDER': 'Your Name <>',
    'SMTP_HOST': '',
    'SMTP_PORT': 465,
    'SMTP_USERNAME': '',
    'SMTP_PASSWORD': 'password'

That’s all. Look at the live example and its code in the example folder. Full list of available settings you can find in aiohttp_login/ file.

Run the example

Create a virtual environment and install the dependencies:

cd example
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Create postgres database and tables:

createdb aiohttp_login
psql -d aiohttp_login -f ../aiohttp_login/pg_tables.sql

Rename to and populate it with real data.

Run the server:


Run tests

pip install -r requirements-dev.txt
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
aiohttp-login-1.3.0.tar.gz (19.0 kB) Copy SHA256 Checksum SHA256 Source Jun 3, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting