Metadata-Version: 2.1
Name: mitol-django-oauth-toolkit-extensions
Version: 1.3.0
Summary: MIT Open Learning django app extensions for oauth toolkit
License: BSD 3-Clause License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.7
Description-Content-Type: text/markdown

mitol-django-oauth-toolkit-extensions
---

This is the Open Learning's extensions to `django-oauth-toolkit`.

### Getting started

`pip install mitol-django-oauth-toolkit-extensions`


### Configuration


Add the following to `settings.py`:

```python
INSTALLED_APPS = [
    ...
    "mitol.oauth_toolkit_extensions.apps.OAuthToolkitExtensionsApp",
]

# required for migrations
OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL = 'oauth2_provider.AccessToken'
OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'
OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL = 'oauth2_provider.RefreshToken'

OAUTH2_PROVIDER = {
    ...
    # enable the custom scopes backends
    "SCOPES_BACKEND_CLASS": "mitol.oauth_toolkit_extensions.backends.ApplicationAccessOrSettingsScopes",
}
```


### Usage

After installing this app, a modified `Application` django-admin interface (/admin/oauth2_provider/application/) is available that allows you to optionally create an `ApplicationAccess` record. If you create this record, it will limit scope authorization to the scopes specified in that record. Otherwise the allowed scopes will be derived from settings.
