Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mediatek
Base de données Mediatek
Commits
fe55a2a5
Verified
Commit
fe55a2a5
authored
Nov 14, 2021
by
ynerant
Browse files
Don't hardcode OAuth2 parameters
parent
cdcb743b
Pipeline
#9544
passed with stages
in 2 minutes and 48 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
med/settings.py
View file @
fe55a2a5
...
...
@@ -167,22 +167,26 @@ PAGINATION_NUMBER = 25
AUTH_USER_MODEL
=
'users.User'
# AUTHLIB CLIENTS
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'
:
'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_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'
:
'1_1 2_1 48_1'
,
'scope'
:
NOTE_KFET_SCOPES
,
}
}
}
try
:
from
.settings_local
import
*
except
ImportError
:
pass
med/settings_local.example.py
View file @
fe55a2a5
...
...
@@ -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'
users/models.py
View file @
fe55a2a5
...
...
@@ -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'
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment