Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Webasauna magic login addon

Project description

This is a Python package for magiclogin, an addon for Websauna framework.

To run this package you need Python 3.5.2+, PostgresSQL and Redis.


  • Passwordless login with OAuth and email link options.
  • Throttle protection against brute forcing and spam
  • Interstitial page to require user to login and then continue what ever HTTP GET/POST action user was performing



Setup OAuth credential in development.ini and development-secrets.ini according to Websauna documentation.

Example development.ini:

websauna.social_logins =

Example development-secrets.ini bits:

class = authomatic.providers.oauth2.Facebook
consumer_key = xxx
consumer_secret = yyy
scope = user_about_me, email
mapper =

class = websauna.system.user.googleoauth.Google
consumer_key = xxx
consumer_secret = yyy
mapper =
scope = profile email

Copy bits from to your application initializer.


Available INI settings:

# Throttle email login endpoints to this window
magiclogin.login_email_throttle = 50/3600

# How fast email login link dies
magiclogin.email_token_expiration_seconds = 300

# Text shown on the login panel
magiclogin.login_slogan = Your login text goes here

You might also have long, secure, sessions in production:

# Set session length to one year
redis.sessions.cookie_max_age = 31536000
redis.sessions.cookie_secure = True
redis.sessions.cookie_httponly = True

Running the development website

Local development machine

Example (OSX / Homebrew):

createdb magiclogin_dev
ws-sync-db  ws://websauna/magiclogin/conf/development.ini
pserve ws://websauna/magiclogin/conf/development.ini --reload

You can visit:



Running the test suite

First create test database:

# Create database used for unit testing
psql create magiclogin_test

Install test and dev dependencies (run in the folder with

pip install -e ".[dev,test]"

Run test suite using py.test running:


More information

Please see

Changelog for Websauna Magic Login

1.0a2 (2018-04-22)

  • Fix missing ‘namespace_packages’.

1.0a1 (2018-03-06)

  • Initial Release

Project details

Download files

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

Files for websauna.magiclogin, version 1.0a2
Filename, size File type Python version Upload date Hashes
Filename, size websauna.magiclogin-1.0a2-py3-none-any.whl (127.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size websauna.magiclogin-1.0a2.tar.gz (120.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page