Giter Club home page Giter Club logo

django-allauth-hatena's Introduction

django-allauth-hatena

This repository provides a oauth library which can login hatena using django-allauth. You can use this as part of the allauth.socialaccount.providers.

Install

django-allauth-hatena can install using pip.

$ pip install django-allauth-hatena

It is required django-allauth, so you should install django-allauth.

Usage

Basic setting

Please add allauth_hatena to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    ...
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth_hatena',
]

And, set authentication backend for allauth.

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',
)

After that, set socialaccount provider.

# allauth joins multiple scopes with whitespace.
# https://github.com/pennersr/django-allauth/blob/0.35.0/allauth/socialaccount/providers/oauth/views.py#L47
# But, hatena API accept multiple scopes with comma.
# http://developer.hatena.ne.jp/ja/documents/auth/apis/oauth/consumer
# So, you should join with comma when you use multiple scopes.
SOCIALACCOUNT_PROVIDERS = {
    'hatena': {
      'SCOPE': ['read_public,write_public']
    }
}

urls.py:

urlpatterns = [
    ...
    url(r'^accounts/', include('allauth.urls')),
    ...
]

Add provider

It is same as normal django-allauth setting.

$ ./manage.py migrate

Now start your server, visit your admin pages (e.g. http://localhost:8000/admin/) and add hatena provider to Social App.

License

The package is available as open source under the terms of the MIT License.

django-allauth-hatena's People

Contributors

h3poteto avatar

Watchers

 avatar  avatar

Forkers

andrean

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.