Skip to content

Using OAuth

abztrakt edited this page Apr 25, 2012 · 7 revisions

This still needs documentation for setting up the views/templates required for 3-legged oauth.

Add this to your settings.py INSTALLED_APPS:

'oauth_provider'

Add this to your urls.py urlpatterns:

url(r'^oauth/', include('oauth_provider.urls')),

In your virtualenv, run this command:

pip install oauth_provider
pip install oauth2

Add this to your settings.py:

SPOTSEEKER_AUTH_MODULE = 'spotseeker_server.auth.oauth'

To create new clients, run this command in the spot seeker project:

python manage.py create_consumer

The name it prompts you for will be shown to users in 3-legged auth. Track the key and secret somewhere secure.

To enable logging that includes oauth app and user info add this to your settings.py:

In MIDDLEWARE_CLASSES:

'spotseeker_server.logger.oauth.LogMiddleware',

and in LOGGING:

'loggers': {
    'spotseeker_server.logger.oauth': {
        'handlers': ['console'],
        'level':'INFO',
    }
},
'handlers': {
    'console': {
        'level':'INFO',
        'class':'logging.StreamHandler',
    },
}

Clone this wiki locally