Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
add oauth config with allauth
Browse files Browse the repository at this point in the history
  • Loading branch information
MJedr committed Nov 7, 2023
1 parent 97406fa commit bb3065e
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"drf_spectacular",
"oauth2_provider",
"social_django",
"allauth.socialaccount.providers.orcid",
]

LOCAL_APPS = ["backoffice.users", "backoffice.workflows", "backoffice.management"]
Expand Down Expand Up @@ -356,11 +357,15 @@
"SERVE_PERMISSIONS": ["rest_framework.permissions.IsAdminUser"],
}
# OAuth
SOCIAL_AUTH_JSONFIELD_ENABLED = True
SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
"social_core.backends.orcid.OrcidOAuth2",
"django.contrib.auth.backends.ModelBackend",
)
SOCIAL_AUTH_USER_MODEL = "users.User"
SOCIAL_AUTH_ORCID_KEY = env("SOCIAL_AUTH_ORCID_KEY", default="")
SOCIAL_AUTH_ORCID_SECRET = env("SOCIAL_AUTH_ORCID_SECRET", default="")
SOCIALACCOUNT_PROVIDERS = {
"orcid": {
# For each OAuth based provider, either add a ``SocialApp``
# (``socialaccount`` app) containing the required client
# credentials, or list them here:
"APP": {
"client_id": env("ORCID_CLIENT_ID", default=""),
"secret": env("ORCID_CLIENT_SECRET", default=""),
"key": "",
}
}
}

0 comments on commit bb3065e

Please sign in to comment.