Don't hardcode OAuth2 parameters
This commit is contained in:
parent
cdcb743b55
commit
fe55a2a5ea
|
@ -167,22 +167,26 @@ PAGINATION_NUMBER = 25
|
|||
|
||||
AUTH_USER_MODEL = 'users.User'
|
||||
|
||||
# AUTHLIB CLIENTS
|
||||
AUTHLIB_OAUTH_CLIENTS = {
|
||||
'notekfet': {
|
||||
'client_id': 'qtElmOUj67YNvSZjA5l70ITUMxd3NJ9kksBsK5e9',
|
||||
'client_secret': 'SwF909sLIeU5GhruXsFzKfdBhFNgs8nvkVpFKgP4pIQ80BmLLlf3ZkMoNL7Cpox6Ke3MXNWGswTtbKkM8AiB9v6pys8PNfYH0MDFWAi3tnffjwaMQBzRFhjx20qb6S4W',
|
||||
'access_token_url': 'https://note-dev.crans.org/o/token/',
|
||||
'refresh_token_url': 'https://note-dev.crans.org/o/token/',
|
||||
'authorize_url': 'https://note-dev.crans.org/o/authorize/',
|
||||
'userinfo_endpoint': 'https://note-dev.crans.org/api/me/',
|
||||
'client_kwargs': {
|
||||
'scope': '1_1 2_1 48_1',
|
||||
}
|
||||
}
|
||||
}
|
||||
NOTE_KFET_URL = 'https://note.crans.org'
|
||||
NOTE_KFET_CLIENT_ID = 'CHANGE_ME'
|
||||
NOTE_KFET_CLIENT_SECRET = 'CHANGE_ME'
|
||||
NOTE_KFET_SCOPES = '1_1 2_1 48_1'
|
||||
|
||||
try:
|
||||
from .settings_local import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
AUTHLIB_OAUTH_CLIENTS = {
|
||||
'notekfet': {
|
||||
'client_id': f'{NOTE_KFET_CLIENT_ID}',
|
||||
'client_secret': f'{NOTE_KFET_CLIENT_SECRET}',
|
||||
'access_token_url': f'{NOTE_KFET_URL}/o/token/',
|
||||
'refresh_token_url': f'{NOTE_KFET_URL}/o/token/',
|
||||
'authorize_url': f'{NOTE_KFET_URL}/o/authorize/',
|
||||
'userinfo_endpoint': f'{NOTE_KFET_URL}/api/me/',
|
||||
'client_kwargs': {
|
||||
'scope': NOTE_KFET_SCOPES,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,3 +40,8 @@ DATABASES = {
|
|||
'PORT': '',
|
||||
}
|
||||
}
|
||||
|
||||
NOTE_KFET_URL = 'https://note.crans.org'
|
||||
NOTE_KFET_CLIENT_ID = 'CHANGE_ME'
|
||||
NOTE_KFET_CLIENT_SECRET = 'CHANGE_ME'
|
||||
NOTE_KFET_SCOPES = '1_1 2_1 48_1'
|
||||
|
|
|
@ -178,7 +178,7 @@ class AccessToken(models.Model):
|
|||
Extract information about the Note Kfet API by using the current
|
||||
access token.
|
||||
"""
|
||||
data = requests.get('https://note-dev.crans.org/api/me/',
|
||||
data = requests.get(f'{settings.NOTE_KFET_URL}/api/me/',
|
||||
headers=self.auth_header()).json()
|
||||
username = data['username']
|
||||
email = data['email']
|
||||
|
|
Loading…
Reference in New Issue