Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication failure due to cookies being disabled #4

Closed
mobeigi opened this issue Jul 24, 2019 · 5 comments
Closed

Authentication failure due to cookies being disabled #4

mobeigi opened this issue Jul 24, 2019 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@mobeigi
Copy link
Owner

mobeigi commented Jul 24, 2019

Upon authenticating, one user got this Facebook error:
Cookies are disabled in your browser. Enable cookies in the browser settings to continue.

Will add further details soon.

@mobeigi mobeigi added the bug Something isn't working label Jul 24, 2019
@mobeigi mobeigi added this to the V1.01 milestone Jul 24, 2019
@mobeigi
Copy link
Owner Author

mobeigi commented Jul 25, 2019

From what I can gather, some websites like Facebook prevent logging in if cookies are disabled.
To test, disable cookies on *.facebook.com, try to log in and you're presented with an error page with the above message.

It seems like the browser requests from the script is somehow failing to correctly store/attain cookies from Facebook for some users resulting in failure to authenticate. I'm not too sure exactly if this is a script issue, config issue elsewhere on the system or potentially a FB related issue.

Relevant links:
https://stackoverflow.com/questions/31309937/python-mechanize-log-into-facebook-cookie-error
https://stackoverflow.com/questions/33314934/mechanize-and-cookie-enable
https://stackoverflow.com/questions/24250662/set-mechanize-to-accept-cookies/25085864#25085864
https://stackoverflow.com/questions/46512712/mechanicalsoup-amazon-login-cookie-problems

@mobeigi mobeigi modified the milestones: V1.01, V1.02 Jul 27, 2019
@mobeigi mobeigi modified the milestones: 1.0.2, 1.1.0 Aug 2, 2019
@mobeigi mobeigi added the help wanted Extra attention is needed label Aug 2, 2019
@mobeigi mobeigi pinned this issue Aug 2, 2019
@mobeigi mobeigi modified the milestones: 1.1.0, 1.0.3 Aug 3, 2019
@mobeigi
Copy link
Owner Author

mobeigi commented Aug 3, 2019

This issue has been reproduced/fixed.
Special thanks to @3rasernl and /u/SylarPower for helping me reproducing this.

I was finally able to reproduce this issue by using a VPN and changing my IP to be from Italy.
For countries that must comply with GDPR cookie laws, Facebook displays a banner showing a generic cookie notice. You must interact with this banner before you are able to 'proceed' to login to Facebook. Interaction is as simple as hovering over the banner. Thus this is why only European users were facing this issue.

Once you interact with the banner, javascript sets two cookies _js_datr, datr with a datr token value which are validated upon logging in. The datr token can be scraped from the login page. It seems only the datr cookie is needed to allow the login to proceed.

Note that cookies were actually never disabled despite the Facebook error message.

@jonicunha
Copy link

Still can't run the script:

PS C:\Users\jonic\Desktop\fb2cal-master_1.0.2\fb2cal-master\src> python .\fb2cal.py
[2019-08-03 10:48:21,065] fb2cal INFO () Starting fb2cal v1.0.2 (Production) [https://git.io/fjMwr]
[2019-08-03 10:48:21,066] fb2cal INFO () This project is released under the GPLv3 license.
[2019-08-03 10:48:21,067] fb2cal INFO (main) Attemping to parse config file config.ini...
[2019-08-03 10:48:21,070] fb2cal INFO (main) Config successfully loaded.
[2019-08-03 10:48:21,070] fb2cal INFO (main) Logging level set to: INFO
[2019-08-03 10:48:21,071] fb2cal INFO (main) Authenticating with Google Drive API...
[2019-08-03 10:48:21,077] googleapiclient.discovery INFO (_retrieve_discovery_doc) URL being requested: GET https://www.googleapis.com/discovery/v1/apis/drive/v3/rest
[2019-08-03 10:48:21,279] fb2cal INFO (main) Successfully authenticated with Google Drive API.
[2019-08-03 10:48:21,280] fb2cal INFO (main) Attemping to authenticate with Facebook...
[2019-08-03 10:48:22,474] fb2cal ERROR (main) Failed to authenticate with Facebook with email [email protected]. Please check provided email/password.
Traceback (most recent call last):
File ".\fb2cal.py", line 732, in
main()
File ".\fb2cal.py", line 113, in main
raise SystemError
SystemError

I tried to reset all cookies from facebook but I still don't see that banner when I access facebook.com/login.php for the frist time. The cookies stored are:
c_user
datr
fr
presence
sb
spin
wd
xs

Can you try it with Portugues IP please?
Thank you

@mobeigi
Copy link
Owner Author

mobeigi commented Aug 3, 2019

@jonicunha I can try Portuguese IP soon but please change logging level to DEBUG in config.ini and email me the log file. That was we can see what actual issue is. My email is on my Github profile page.

@mobeigi
Copy link
Owner Author

mobeigi commented Aug 3, 2019

@jonicunha Unfortunately my VPN provider does not provide a Portuguese IP. A Spanish IP works fine though.

Thanks for sending me the log files. It is the same cookie issue:

Os cookies não estão ativados no teu browser. Ativa os cookies nas preferências do teu browser para continuares.

Are you sure you are using the latest version of the code?
If you are then I'll probably need more information to reproduce the issue.

@mobeigi mobeigi unpinned this issue Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants