Functions

Helper functions for use with Authomatic.

authomatic.provider_id A simple counter to be used in the config to generate unique IDs.
authomatic.provider_id()[source]

A simple counter to be used in the config to generate unique IDs.

Returns:int.

Use it in the Config like this:

import authomatic

CONFIG = {
    'facebook': {
         'class_': authomatic.providers.oauth2.Facebook,
         'id': authomatic.provider_id(), # returns 1
         'consumer_key': '##########',
         'consumer_secret': '##########',
         'scope': ['user_about_me', 'email']
    },
    'google': {
         'class_': 'authomatic.providers.oauth2.Google',
         'id': authomatic.provider_id(), # returns 2
         'consumer_key': '##########',
         'consumer_secret': '##########',
         'scope': ['https://www.googleapis.com/auth/userinfo.profile',
                   'https://www.googleapis.com/auth/userinfo.email']
    },
    'windows_live': {
         'class_': 'oauth2.WindowsLive',
         'id': authomatic.provider_id(), # returns 3
         'consumer_key': '##########',
         'consumer_secret': '##########',
         'scope': ['wl.basic', 'wl.emails', 'wl.photos']
    },
}
Fork me on GitHub