Metadata-Version: 2.4
Name: mitol-django-oauth-toolkit-extensions
Version: 2026.4.2
Summary: MIT Open Learning django app extensions for oauth toolkit
License-Expression: BSD-3-Clause
Requires-Python: >=3.10
Requires-Dist: django-oauth-toolkit>=1.3.3
Requires-Dist: django-stubs>=1.13.1
Requires-Dist: django>=3.0
Requires-Dist: factory-boy~=3.2
Requires-Dist: mitol-django-common
Requires-Dist: pytz>=2020.4
Requires-Dist: requests>=2.20.0
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.
