22

So I'm having a problem where I'm not able to log in to Stack Overflow.

As all Stack Overflow (SO) users will know, there are four ways to log in to SO. One is to sign in using Google, the second is from GitHub, the third from Facebook, and finally through the conventional way of email and password.

I hadn't logged in to SO for over five months or so, and when I logged in it just didn't allow me to do so. I first tried the conventional way of email and password. It returned me back straight to the login page.

Then I tried logging in with Google. At first, it did the same as before, i.e. sent me back to the login page, but when I did it a few more times, it showed this message:

Request lacked state, may have been forged

And then it sent this same message every time.

And then, at last, I tried logging in using GitHub. And then, it didn't even direct me to GitHub! It just sent the same message that the "Request lacked state," blah blah blah.

So... I'm stuck here and I cannot login in any way. What can I do?

P.S. - I don't use Facebook and thus can't log in that way.

7
  • 5
    You might be using some plugin and/or security software that blocks cookies. Disable it or whitelist SO, then try again. Commented Nov 17, 2020 at 7:18
  • 2
    See comments here. Most likely same issue in your case. Commented Nov 17, 2020 at 7:20
  • No, I ain't using any AdBlock or things like that. I freshly built my new PC so it's got no bloatware/unnecessary software in it.
    – LoneWolf
    Commented Nov 17, 2020 at 9:44
  • 1
    Well, what browser are you using then? Commented Nov 17, 2020 at 9:56
  • Google Chrome and sometimes Firefox. Same results in both browsers.
    – LoneWolf
    Commented Nov 17, 2020 at 10:06
  • 1
    Maybe(because the functioning seems sporadic) try under 'edit profile and settings' going to 'My logins' and then click on 'add more logins...' and add a new email address as a login; the new email address login seems to go across different se sites
    – M H
    Commented Dec 2, 2020 at 0:04
  • 1
    The new login email may(may because functioning is sporadic) allow a new password setting and then confirmation email sent to it containing the new login confirmation link, which then can be clicked on to confirm the new email & password as a login, which apparently is valid over different se sites; this is in chrome. Thank you :)
    – M H
    Commented Dec 2, 2020 at 0:11

5 Answers 5

22
+150

The solution is to allow cookies for Stack Overflow. Sometimes browsers tend to automatically block cookies but if you allow them you're good to go.

Steps to allow third party cookies in Chrome browser:

  1. Click the More icon (three vertical dots), then click Settings.
  2. Click "Privacy and security" in the left navigation bar.
  3. Click "Site Settings".
  4. Scroll down, and under "Content" click "Cookies and other site data".
  5. Tick the "Allow all cookies" or "Block third-party cookies in Incognito".
  6. Try to log in again to Stack Overflow.

Steps to allow third party cookies in Firefox:

  1. Click the hamburger menu button on the top right corner.
  2. Select "options".
  3. Go to the privacy and security section.
  4. Click "Manage exceptions" option under "Cookies and site data".
  5. Add the URL of Stack Overflow (www.stackoverflow.com) and select "save".
  6. Try to login again to Stack Overflow.

If that doesn't fix your problem, try clearing cookies and device cache, logging in using incognito mode/private mode, logging in from a different device, and then finally contact the Stack Overflow team if your problems are still persistent.

4
  • 2
    Very interesting, but does not work. I still see that message, even after allowing 3rd party cookies. What is interesting it is only SO problem, other SE sites login correctly.
    – Gangnus
    Commented Jan 14, 2021 at 16:36
  • This worked in combination with @Blink's answer about adblockers. However, it's been 2 years before I found this answer. The top hits when looking into this problem are hot debates about the lack of support for GitHub authentication across the network so I'm wondering how many other users are unaware that there is a workaround?
    – a2k42
    Commented Jan 22, 2023 at 0:31
  • Honestly stack overflow needs to update its authentication system. It has become so popular and still such shortcomings in the authentication leads to the users facing these issues.
    – LoneWolf
    Commented Jan 27, 2023 at 6:02
  • Just a small thing - my browsers set up to not allow cookies for any website without my express permission (I can still log in whenever I want, to anything I want though). Just saying that while it may have worked, it may not be the root issue (though it probably is, for you at least).
    – Daemons
    Commented Mar 28 at 23:39
11

For me, it was Adblock Plus that was preventing the login. I disabled it temporarily, logged in, and everything works. Chrome Version 87.0.4280.88 (Official Build) (x86_64) macOS 11.0.1

2
  • Yeah, that solution also works sometimes
    – LoneWolf
    Commented Dec 13, 2020 at 5:14
  • 1
    I had to do that, also I had to disable BlockSite. Once I had done that and logged into at least one StackAuth-protected site, it looks like I can log in again without disabling those. Weird! Thanks for the help. Commented Mar 19, 2021 at 5:05
11

This happened to me on a newly installed Arch Linux system. It was resolved by enabling NTP with timedatectl set-ntp true.

Edit: to be clear, I had first tried clearing cookies, forgetting the page from history and using a private window on Firefox.

4
  • 4
    saved my day. There should be a possibility to tag solutions for specific problems.
    – MaKaNu
    Commented Oct 9, 2022 at 12:49
  • 2
    thanks a lot, I had the same issue on Manjaro - I guess it was my own fault due to me setting the wrong time in bios :-) Commented Nov 22, 2022 at 21:12
  • 1
    I have an issue on my Windows 11 computer that causes the time to go out of sync frequently. Synchronizing the time by right-clicking the time on the taskbar, selecting "Set date and time", and then scrolling down and clicking "Sync now" worked for me. Commented Mar 4 at 23:48
  • I'd done an in-place repair install on my Windows 10. I didn't think this was the issue at first because the display clock was accurate. When I looked at my date and time settings (thanks @CainGoldhardt), under "Synchronize your clock", it was wildly outdated. Snycing with time.windows.com fixed my issue.
    – Blend3rman
    Commented Sep 8 at 13:21
4

The quickest way in

In short, StackOverflow checks the cookies. The quickest way to give permission in Google Chrome browser:

  1. Type the below address in the URL

chrome://settings/cookies

  1. Select "Allow all cookies" or "Block third-party cookies in Incognito".
  2. Log in again

In Firefox

  1. Type the below address in the URL

about:preferences#privacy

  1. Click on the "Manage exceptions" option under "Cookies and site data".
  2. Add the URL of the website which is "www.stackoverflow.com" and click on "Save Changes".
  3. Log in again
3

In Chrome, rather than blindly allowing all cookies, you can

  1. go to: chrome://settings/cookies
  2. locate Sites that can always use cookies
  3. click Add
  4. enter: [*.]stackoverflow.com
  5. click Add to confirm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .