{"action":"opened","issue":{"url":"https://api.github.com/repos/corydolphin/flask-cors/issues/220","repository_url":"https://api.github.com/repos/corydolphin/flask-cors","labels_url":"https://api.github.com/repos/corydolphin/flask-cors/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/corydolphin/flask-cors/issues/220/comments","events_url":"https://api.github.com/repos/corydolphin/flask-cors/issues/220/events","html_url":"https://github.com/corydolphin/flask-cors/issues/220","id":320568334,"number":220,"title":"flask-cors authenticated requests with current_user","user":{"login":"jodiwaljay","id":17160296,"avatar_url":"https://avatars1.githubusercontent.com/u/17160296?v=4","gravatar_id":"","url":"https://api.github.com/users/jodiwaljay","html_url":"https://github.com/jodiwaljay","followers_url":"https://api.github.com/users/jodiwaljay/followers","following_url":"https://api.github.com/users/jodiwaljay/following{/other_user}","gists_url":"https://api.github.com/users/jodiwaljay/gists{/gist_id}","starred_url":"https://api.github.com/users/jodiwaljay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodiwaljay/subscriptions","organizations_url":"https://api.github.com/users/jodiwaljay/orgs","repos_url":"https://api.github.com/users/jodiwaljay/repos","events_url":"https://api.github.com/users/jodiwaljay/events{/privacy}","received_events_url":"https://api.github.com/users/jodiwaljay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-06T07:00:16Z","updated_at":"2018-05-06T07:00:16Z","closed_at":null,"author_association":"NONE","body":"I have added after creating flask app instance\r\n`CORS(app, supports_credentials=True)`\r\n\r\nfor login and checking authentication I am using\r\n```\r\n@app.route('/check_auth', methods=['GET'])\r\ndef check_auth():\r\n    if current_user.is_authenticated:\r\n        return success({ \"message\": 'Logged in', \"user\": current_user.obj_to_dict() })\r\n    return error('Not logged in', status_code=403)\r\n\r\n\r\n@app.route('/login', methods=['POST'])\r\ndef login():\r\n    \"\"\"Login Form\"\"\"\r\n    username = request.json['username']\r\n    password = request.json['password']\r\n    data = User.query.filter_by(username=username).first()\r\n    if data and bcrypt.check_password_hash(data.password, password.encode('utf-8')):\r\n        login_user(data)\r\n        dataDict = data.obj_to_dict(skip_columns=['password'])\r\n        return success({ \"message\": 'successful', \"data\": dataDict })\r\n    else:\r\n        return error('Wrong username or password', status_code=403)\r\n```\r\n\r\ncurrent_user.is_authenticated results false. But works perfectly fine in postman. Also if I remove CORS and try current_user.is_authenticated it works. So I'm sure issue is related with CORS.\r\n\r\nMany similar issues are already present. Looking through them suggests that session problem is solved by using `supports_credentials=True` but current_user returns anonymous for me even after using setting this argument"}}
{"actor":{"display_login":"jodiwaljay"}}