diff --git a/profiles/community/github_mock/flaskapp.py b/profiles/community/github_mock/flaskapp.py index 1ae99a889f..2dad76b2c7 100644 --- a/profiles/community/github_mock/flaskapp.py +++ b/profiles/community/github_mock/flaskapp.py @@ -189,7 +189,7 @@ def set_session(sid, uid): def get_access_token_by_id(sid): conn = sqlite3.connect(db_name) cursor = conn.cursor() - cursor.execute('SELECT access_token,uid FROM access_tokens WHERE id = ?', (sid,)) + cursor.execute('SELECT access_token,uid FROM access_tokens WHERE access_token = ?', (sid,)) row = cursor.fetchone() rsid = row[0] userid = row[1] @@ -201,7 +201,7 @@ def set_access_token(token, uid): conn = sqlite3.connect(db_name) cursor = conn.cursor() cursor.execute( - 'INSERT into access_tokens (id, uid) VALUES (?, ?)', + 'INSERT into access_tokens (access_token, uid) VALUES (?, ?)', (token, uid) ) conn.commit() @@ -222,7 +222,7 @@ def delete_access_token(token): def get_csrf_token_by_id(sid): conn = sqlite3.connect(db_name) cursor = conn.cursor() - cursor.execute('SELECT csrf_token,uid FROM access_tokens WHERE id = ?', (sid,)) + cursor.execute('SELECT csrf_token,uid FROM access_tokens WHERE csrf_token = ?', (sid,)) row = cursor.fetchone() rsid = row[0] userid = row[1] @@ -298,7 +298,9 @@ def do_access_token(): # client_secret = ds['client_secret'] # Match the acces_code to the username and invalidate it - username = ACCESS_TOKENS[access_code] + #username = ACCESS_TOKENS[access_code] + _at = get_access_token_by_id(access_code) + udata = get_user_by_id(_at['uid']) # ACCESS_TOKENS.pop(access_code, None) delete_access_token(access_code)