Skip to content

Commit c564e25

Browse files
authored
updated calling to oauth to login
1 parent 05f644f commit c564e25

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

apps/backend/api/v0/oauth2_routes.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,18 @@ def login_with_iot_callback():
251251
print("User updated")
252252
User.user_add_community(session_token, bcn_community_obj.id)
253253
print("User added to community")
254-
token = authorization.create_token_response(request)
255-
print("token created")
256-
return token
254+
255+
headers = {'Authorization': 'Basic QXpyV0xIOHh3MXhHWW9QQkJ0MWxQNHhsOlYyQ1F0NjdqT1hUcGVWNEJyRE11bVFPY2thMUhFcFFtRFdwNzJsMW1udXR6NTJqOA=='} # + b64encode(bytes(cfg['oauth']['client_username'] + ':' + cfg['oauth']['client_password'], 'utf-8')).decode('utf-8')}
256+
PARAMS = {'grant_type': 'password', 'username': session_token, 'scope': 'profile', 'password': 'dummy'}
257+
r = requests.post(url='http://84.88.76.45:887/oauth/login', params=PARAMS, headers=headers)
258+
data = r.json()
259+
response = jsonify(message="Logged OK")
260+
response.status_code = 200
261+
return response
262+
263+
# token = authorization.create_token_response(request)
264+
# print("token created")
265+
# return token
257266
else:
258267
response = jsonify(message="Invalid Token")
259268
response.status_code = 401

0 commit comments

Comments
 (0)