Commit 4153645a authored by Roman Sebastian Karwacik's avatar Roman Sebastian Karwacik
Browse files

fixed moodle authentication

parent a9a8ce3a
......@@ -11,8 +11,8 @@ def l2pget(endpoint, token, **args):
return r.json()
def moodleget(endpoint, token, **args):
args['accessToken'] = token
r = requests.request('GET', L2P_BASE+endpoint, params=args)
args['token'] = token
r = requests.request('GET', MOODLE_BASE+endpoint, params=args)
return r.json()
def oauthget(endpoint, **args):
......@@ -67,6 +67,6 @@ def finish_oauth():
elif session['oauthscope'] == 'moodle':
session['moodle_courses'] = []
for course in moodleget('getmyenrolledcourses', token['access_token'])['Data']:
session['moodle_courses'].append(course['id'])
session['moodle_courses'].append(str(course['id']))
del session['oauthscope']
oauthget('token', refresh_token=token['refresh_token'], grant_type='invalidate')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment