Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/auth/login', methods=['POST'])
- def login_user():
- """user login [POST]"""
- user_data = request.get_json()
- username = user_data.get('username')
- password = user_data.get('password')
- for user in users:
- if user['password'] ==password and user['username']==username:
- token = jwt.encode({'user': username}, 'you are my sunshine', algorithm='HS256')
- response ={'message': 'You are successfully logged in','token': token.decode('utf-8')}
- return jsonify({'response':response})
- # 'token': token.decode('utf-8'))}
- return 'username does not match password'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement