Skip to content

Commit

Permalink
updated calling to oauth to login
Browse files Browse the repository at this point in the history
  • Loading branch information
noktus authored Oct 28, 2019
1 parent 05f644f commit c564e25
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions apps/backend/api/v0/oauth2_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,18 @@ def login_with_iot_callback():
print("User updated")
User.user_add_community(session_token, bcn_community_obj.id)
print("User added to community")
token = authorization.create_token_response(request)
print("token created")
return token

headers = {'Authorization': 'Basic QXpyV0xIOHh3MXhHWW9QQkJ0MWxQNHhsOlYyQ1F0NjdqT1hUcGVWNEJyRE11bVFPY2thMUhFcFFtRFdwNzJsMW1udXR6NTJqOA=='} # + b64encode(bytes(cfg['oauth']['client_username'] + ':' + cfg['oauth']['client_password'], 'utf-8')).decode('utf-8')}
PARAMS = {'grant_type': 'password', 'username': session_token, 'scope': 'profile', 'password': 'dummy'}
r = requests.post(url='http://84.88.76.45:887/oauth/login', params=PARAMS, headers=headers)
data = r.json()
response = jsonify(message="Logged OK")
response.status_code = 200
return response

# token = authorization.create_token_response(request)
# print("token created")
# return token
else:
response = jsonify(message="Invalid Token")
response.status_code = 401
Expand Down

0 comments on commit c564e25

Please sign in to comment.