47 lines
1.1 KiB
Markdown
47 lines
1.1 KiB
Markdown
Para añadir las modificaciones de esta rama hay que modificar el fichero panel/panel settings.py
|
|
|
|
Añadir modulo en:
|
|
|
|
INSTALLED_APPS = [
|
|
...
|
|
'oauth2_provider',
|
|
]
|
|
|
|
seguido de la siguientes configuraciones:
|
|
|
|
MIDDLEWARE = (
|
|
...
|
|
#oauth
|
|
'oauth2_provider.middleware.OAuth2TokenMiddleware',
|
|
)
|
|
|
|
|
|
AUTHENTICATION_BACKENDS = [
|
|
...
|
|
'oauth2_provider.backends.OAuth2Backend',
|
|
]
|
|
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
|
...
|
|
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
|
|
),
|
|
}
|
|
|
|
OAUTH2_PROVIDER = {
|
|
# this is the list of available scopes
|
|
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}
|
|
}
|
|
|
|
|
|
Despues de assignar las anteriores configuraciones será necesario aplicar migrate
|
|
|
|
python3 manage.py migrate
|
|
|
|
---
|
|
|
|
Esta informacion se extrajo de:
|
|
|
|
- https://django-oauth-toolkit.readthedocs.io/en/latest/getting_started.html
|
|
- https://django-oauth-toolkit.readthedocs.io/en/latest/rest-framework/rest-framework.html |