Coder Social home page Coder Social logo

django-blockstack's Introduction

Blockstack Authentication for Django

This Django application enables Blockstack-based authentication for your website.

Quick start

  1. Add "django_blockstack" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'django_blockstack',
    ]
    
  2. Add "django_blockstack.backends.BlockstackAuthBackend" to your AUTHENTICATION_BACKENDS setting like this:

    AUTHENTICATION_BACKENDS = [
        'django_blockstack.backends.BlockstackAuthBackend',
        ...
    ]
    
  3. Add BLOCKSTACK_AUTH setting (blockstack_api is only needed if you run local Blockstack Core in API mode):

    BLOCKSTACK_AUTH = {
        'settings': {
            'private_key': 'a5c61c6ca7b3e7e55edee68566aeab22e4da26baa285c7bd10e8d2218aa3b22901',
            'domain_name': 'http://localhost:8000'
        },
        'manifest': {
            'name': 'Blockstack Auth Test',
            'start_url': 'http://localhost:8000',
            'description': 'A simle demo of Blockstack Auth',
            'icons': [{
                'src': 'http://localhost:8000/static/icon.png',
                'sizes': '420x420',
                'type': 'image/png'
            }]
        },
        'blockstack_api': 'http://localhost:6270'
    }
    
  4. Include the blockstack_auth URLconf in your project urls.py like this:

    url(r'', include('django_blockstack.urls')),
    
  5. Redirect user to '<your_domain_name>/blockstack/request' when he tries to authenticate:

    def login(request):
        ...
        return redirect('blockstack:request')
    
  6. Get Blockstack profile of already authenticated users like this:

    >>> from blockstack_auth.profile import fetch_profile
    >>> fetch_profile(user.username)
    

You can see this app in action in this simple website: https://github.com/spankratov/django-blockstack-test

django-blockstack's People

Contributors

spankratov avatar

Watchers

James Cloos 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.