2023-09-18 07:20:32 +00:00
|
|
|
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
|
|
|
|
|
2023-09-18 07:21:57 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
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
|