Provide OAuth2 access to your app

Overview

django-oauth2-provider

https://travis-ci.org/caffeinehit/django-oauth2-provider.png?branch=master

django-oauth2-provider is a Django application that provides customizable OAuth2-authentication for your Django projects.

Documentation

Help

License

django-oauth2-provider is released under the MIT License. Please see the LICENSE file for details.

Comments
  • Fix the `expires_in` value that was wrong

    Fix the `expires_in` value that was wrong

    Because timedelta.seconds does take into account the days attribute of timedelta.

    >>> from datetime import timedelta
    >>> t = timedelta(days=365)
    >>> t.seconds 
    0
    >>> t.total_seconds()
    30758400.0
    
    opened by dulacp 12
  • Improve the documentation

    Improve the documentation

    Your project is so nicely implemented and clearly commented, I thought it deserves an improved documentation.

    Besides, other great projects like django-rest-framework are willing to use yours as a dependency for the OAuth 2 support, but to achieve that it really needs a fresh-and-stylish documentation :)

    I've made the changes necessary to remove all documentation build warnings. And now the doc will be able to have this beautiful new design. This is a just temporary (and protected) doc to show you how I've changed it.

    opened by dulacp 9
  • Should client_secret be optional with grant type password?

    Should client_secret be optional with grant type password?

    According to[0]:

    Like browser-based apps, mobile apps also cannot maintain the confidentiality of their client secret. Because of this, mobile apps must also use an OAuth flow that does not require a client secret.

    Based on this, shouldn't client_id be enough to get the access token to get access token? Since client_secret could be used for something not directly related to token.

    [0] http://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified

    enhancement compatibility 
    opened by fernandogrd 7
  • Support for Django 1.6

    Support for Django 1.6

    This is adds support for Django 1.6. Specifically, this addresses #51, #53 and #55 by providing support for model serialization prior to storing as session data as well as adjusting form validation code to deal with a regression in the way scope is parsed.

    Feedback welcomed.

    opened by eculver 6
  • Implement OAUTH_DELETE_EXPIRED setting

    Implement OAUTH_DELETE_EXPIRED setting

    This augment's PR #48 by cleaning things up a bit and by adding docs. The original pull request added support for expired tokens and grants instead of setting expiration.

    opened by eculver 6
  • Add email_and_password grant type.

    Add email_and_password grant type.

    I found it useful in my application to add the email_and_password grant type. If you think this makes sense too, feel free to accept. Perhaps there's a simpler way around the issue of using emails as an identifying criterion that I'm missing.

    opened by nick-merrill 5
  • Removing need to client_secret during password grants for public clients

    Removing need to client_secret during password grants for public clients

    As discussed in issues #21 and #25. This provides a more rigerous check of the circumstances required for the client_secret to forgone.

    (includes tests)

    opened by adamcharnock 5
  • Made client_secret optional for password grant

    Made client_secret optional for password grant

    Since we can't trust all clients with the client secret I made the client_secret optional as per this blog post http://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified.

    opened by enyachoke 5
  • Passing scope no longer works

    Passing scope no longer works

    In the ScopeChoice Field class in provider/oauth2/forms.py, the scope choice is no longer parsed correctly, so it raises an invalid_request. Writing something like

    value = value.split('\s') 
    

    in line 60 (instead of raise OAuthValidationError....) fixes the problem

    bug high-priority feedback needed 
    opened by rzelayafavila 4
  • Django 1.6 incompability: TypeError: <Client: http://localhost:8001/callback> is not JSON serializable

    Django 1.6 incompability: TypeError: is not JSON serializable

    Hello there,

    I'm trying to get this library to work. The installation works fine but when I run the code on a Django 1.6 installation, I get the following error after authorizing my app:

    <Client: http://localhost:8001/callback> is not JSON serializable
    

    Stacktrace:

    Environment:
    
    
    Request Method: POST
    Request URL: http://localhost:8000/oauth2/authorize/confirm
    
    Django Version: 1.6
    Python Version: 2.7.5
    Installed Applications:
    ('django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'provider',
     'provider.oauth2',
     'django.contrib.admin')
    Installed Middleware:
    ('django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware')
    
    
    Traceback:
    File "/home/tnaessens/Documents/Projects/Python/oauth2-provider/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
      201.                 response = middleware_method(request, response)
    File "/home/tnaessens/Documents/Projects/Python/oauth2-provider/env/local/lib/python2.7/site-packages/django/contrib/sessions/middleware.py" in process_response
      38.                     request.session.save()
    File "/home/tnaessens/Documents/Projects/Python/oauth2-provider/env/local/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py" in save
      57.             session_data=self.encode(self._get_session(no_load=must_create)),
    File "/home/tnaessens/Documents/Projects/Python/oauth2-provider/env/local/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py" in encode
      87.         serialized = self.serializer().dumps(session_dict)
    File "/home/tnaessens/Documents/Projects/Python/oauth2-provider/env/local/lib/python2.7/site-packages/django/core/signing.py" in dumps
      88.         return json.dumps(obj, separators=(',', ':')).encode('latin-1')
    File "/usr/lib/python2.7/json/__init__.py" in dumps
      250.         sort_keys=sort_keys, **kw).encode(obj)
    File "/usr/lib/python2.7/json/encoder.py" in encode
      207.         chunks = self.iterencode(o, _one_shot=True)
    File "/usr/lib/python2.7/json/encoder.py" in iterencode
      270.         return _iterencode(o, 0)
    File "/usr/lib/python2.7/json/encoder.py" in default
      184.         raise TypeError(repr(o) + " is not JSON serializable")
    
    Exception Type: TypeError at /oauth2/authorize/confirm
    Exception Value: <Client: http://localhost:8001/callback> is not JSON serializable
    

    By googling, I found this similar bug in django-allauth: https://github.com/pennersr/django-allauth/issues/386. This was caused by the change from PickleSerializer to JSONSerializer from Django 1.5 to 1.6 as described here.

    bug high-priority compatibility 
    opened by TomNaessens 4
  • django 1.5

    django 1.5

    Hi,

    I have a patch that's compatible with django 1.5 custom user model

    There are 2 caveats:

    • For the tests I have to update the fixture to use the custom model
    • The migrations still refers auth.User

    I'm not quite sure how to make this work for both Django 1.4 and 1.5 but it's a start.

    --Gilles

    opened by gilles 4
  • Project is Dead. Need a Migration Plan

    Project is Dead. Need a Migration Plan

    I need a migration plan for switching to either djangorestframework-oauth or django-oauth-toolkit. Basically wrapping the current API to the tools provided by one or the other of the above library seems the way to go. Also remove this project from pip / etc or give ownership to someone that will treat the huge pile of issue in it.

    opened by drake-mer 1
  • not working with django>=1.9

    not working with django>=1.9

    I am going to upgrade my django project form django=1.8.13 to django=1.10.3 but its failed and showing errors

    Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line utility.execute() File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 324, in execute django.setup() File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate app_config = AppConfig.create(entry) File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create module = import_module(entry) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/provider/oauth2/__init__.py", line 1, in <module> import backends File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/provider/oauth2/backends.py", line 2, in <module> from .forms import ClientAuthForm, PublicPasswordGrantForm File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/provider/oauth2/forms.py", line 10, in <module> from .models import Client, Grant, RefreshToken File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/provider/oauth2/models.py", line 23, in <module> class Client(models.Model): File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__ app_config = apps.get_containing_app_config(module) File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config self.check_apps_ready() File "/home/nazmul/PycharmProjects/django_auth/local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

    opened by nazmulhasan85 3
  • Needs an Update

    Needs an Update

    /usr/local/lib/python2.7/dist-packages/provider/oauth2/urls.py:54: RemovedInDjango110Warning: django.conf.url s.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django .conf.urls.url() instances instead. name='access_token'),

    opened by Tsangares 0
  • Convert readthedocs link for their .org -> .io migration for hosted projects

    Convert readthedocs link for their .org -> .io migration for hosted projects

    As per their blog post of the 27th April ‘Securing subdomains’:

    Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard.

    Test Plan: Manually visited all the links I’ve modified.

    opened by adamchainz 0
OAuth2 goodies for the Djangonauts!

Django OAuth Toolkit OAuth2 goodies for the Djangonauts! If you are facing one or more of the following: Your Django app exposes a web API you want to

Jazzband 2.7k Jan 1, 2023
OAuth2 goodies for the Djangonauts!

Django OAuth Toolkit OAuth2 goodies for the Djangonauts! If you are facing one or more of the following: Your Django app exposes a web API you want to

Jazzband 2.7k Dec 31, 2022
python-social-auth and oauth2 support for django-rest-framework

Django REST Framework Social OAuth2 This module provides OAuth2 social authentication support for applications in Django REST Framework. The aim of th

null 1k Dec 22, 2022
python-social-auth and oauth2 support for django-rest-framework

Django REST Framework Social OAuth2 This module provides OAuth2 social authentication support for applications in Django REST Framework. The aim of th

null 1k Dec 22, 2022
A full Rest-API With Oauth2 and JWT for request & response a JSON file Using FastAPI and SQLAlchemy 🔑

Pexon-Rest-API A full Rest-API for request & response a JSON file, Building a Simple WorkFlow that help you to Request a JSON File Format and Handling

Yasser Tahiri 15 Jul 22, 2022
API with high performance to create a simple blog and Auth using OAuth2 ⛏

DogeAPI API with high performance built with FastAPI & SQLAlchemy, help to improve connection with your Backend Side to create a simple blog and Cruds

Yasser Tahiri 111 Jan 5, 2023
A Python inplementation for OAuth2

OAuth2-Python Discord Inplementation for OAuth2 login systems. This is a simple Python 'app' made to inplement in your programs that require (shitty)

Prifixy 0 Jan 6, 2022
A wagtail plugin to replace the login by an OAuth2.0 Authorization Server

Wagtail OAuth2.0 Login Plugin to replace Wagtail default login by an OAuth2.0 Authorization Server. What is wagtail-oauth2 OAuth2.0 is an authorizatio

Gandi 7 Oct 7, 2022
FastAPI-Login tries to provide similar functionality as Flask-Login does.

FastAPI-Login FastAPI-Login tries to provide similar functionality as Flask-Login does. Installation $ pip install fastapi-login Usage To begin we hav

null 417 Jan 7, 2023
This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)

Welcome to django-rest-auth Repository is unmaintained at the moment (on pause). More info can be found on this issue page: https://github.com/Tivix/d

Tivix 2.4k Jan 3, 2023
A Python tool to generate and refresh Amazon access tokens.

amazon_auth A Python tool to generate and refresh Amazon access tokens. Description This tool generates and outputs Amazon access and refresh tokens f

null 15 Nov 21, 2022
Use this to create (admin) personal access token in gitlab database. Mainly used for automation.

gitlab-personal-access-token Ensure PAT is present in gitlab database. This tool is mainly used when you need to automate gitlab installation and conf

CINAQ Internet Technologies 1 Jan 30, 2022
Get inside your stronghold and make all your Django views default login_required

Stronghold Get inside your stronghold and make all your Django views default login_required Stronghold is a very small and easy to use django app that

Mike Grouchy 384 Nov 23, 2022
A Python package, that allows you to acquire your RecNet authorization bearer token with your account credentials!

RecNet-Login This is a Python package, that allows you to acquire your RecNet bearer token with your account credentials! Installation Done via git: p

Jesse 6 Aug 18, 2022
Flask JWT Router is a Python library that adds authorised routes to a Flask app.

Read the docs: Flask-JWT-Router Flask JWT Router Flask JWT Router is a Python library that adds authorised routes to a Flask app. Both basic & Google'

Joe Gasewicz 52 Jan 3, 2023
A host-guest based app in which host can CREATE the room. and guest can join room with room code and vote for song to skip. User is authenticated using Spotify API

A host-guest based app in which host can CREATE the room. and guest can join room with room code and vote for song to skip. User is authenticated using Spotify API

Aman Raj 5 May 10, 2022
Flask App With Login

Flask App With Login by FranciscoCharles Este projeto basico é o resultado do estudos de algumas funcionalidades do micro framework Flask do Python. O

Charles 3 Nov 14, 2021
Django Rest Framework App wih JWT Authentication and other DRF stuff

Django Queries App with JWT authentication, Class Based Views, Serializers, Swagger UI, CI/CD and other cool DRF stuff API Documentaion /swagger - Swa

Rafael Salimov 4 Jan 29, 2022
Storefront - A store App developed using Django, RESTFul API, JWT

Storefront A store App developed using Django, RESTFul API, JWT. SQLite has been

Muhammad Algshy 1 Jan 7, 2022