Skip to content

Commit

Permalink
Merge pull request agstack#59 from MHA10/AG-57-Login-Logout-AR
Browse files Browse the repository at this point in the history
Login Logout Flow complete.
  • Loading branch information
Aanish97 authored Apr 12, 2023
2 parents 89ff08d + 536b7b2 commit 830d60e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,16 @@ def login():
data['asset_registry'] = True
try:
res = requests.post(app.config['USER_REGISTRY_BASE_URL'], json=data)
access_token = res.json()['access_token']
refresh_token = res.json()['refresh_token']
json_res = json.loads(res.content.decode())
except Exception as e:
return jsonify({
'message': 'User Registry Error',
'error': f'{e}'
}), 401
if res.status_code == 200:
response_fe = make_response(res.json(), 200)
response_fe.set_cookie('refresh_token_cookie', access_token)
response_fe.set_cookie('access_token_cookie', refresh_token)
response_fe = make_response(jsonify(json_res), 200)
response_fe.set_cookie('refresh_token_cookie', json_res.get('refresh_token'))
response_fe.set_cookie('access_token_cookie', json_res.get('access_token'))
return response_fe
else:
response_fe = make_response(jsonify(json_res), 401)
Expand Down

0 comments on commit 830d60e

Please sign in to comment.