Coder Social home page Coder Social logo

django-janrain's Introduction

django-janrain

Janrain integration into Django using built-in django.contrib.auth package. It creates a django user using django.contrib.auth.models.User on first login and retrieves that User object on future logins.

Installation

Add a url entry in urls.py:

urlpatterns += patterns('',
    (r'^janrain/', include('janrain.urls')),
)

Add janrain to your INSTALLED_APPS:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'janrain',
)

Add janrain.backends.JanrainBackend to AUTHENTICATION_BACKENDS:

# put janrain.backends.JanrainBackend first
AUTHENTICATION_BACKENDS = (
    'janrain.backends.JanrainBackend',
    'django.contrib.auth.backends.ModelBackend',
)

Add your janrain api key to settings:

JANRAIN_RPX_API_KEY = "0123456789abcdef0123456789abcdef0123456789abcdef"

Usage

Configure your token_url in janrain to be http://yoursite.com/janrain/login/

Create a template called janrain/loginpage.html to contain your janrain login iframe:

<iframe src="http://yoursite.rpxnow.com/openid/embed?token_url=http{% if request.is_secure()%}s{%endif%}{{("://" + request.get_host() + "/janrain/login/?next=" + next)|urlencode}}" scrolling="no" frameBorder="no" allowtransparency="true" style="width:400px;height:240px"></iframe>

Place your javascript overlay sign in buttons in your template:

<a class="rpxnow" onclick="return false;" href="https://yoursite.rpxnow.com/openid/v2/signin?token_url=http{% if request.is_secure()%}s{%endif%}{{("://" + request.get_host() + "/janrain/login/?next=" + 'http://yoursite.com/redirect/to/path/')|urlencode}}">Sign In</a>

Create a button to hit /janrain/logout/ to log out.

django-janrain's People

Contributors

spuriousdata avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.