I'm building an app in Go and allowing users to log in using Facebook. I've followed the instruction as carefully as I can, but after I redirect users to Facebook I am getting an error page that says: "Sorry, something went wrong: Please try closing and re-opening your browser window." and that's all.
If I refresh the URL that displayed at the top of the error message, it successfully redirects to my app, provides a code and I'm able to exchange the code for a token.
The only thing that's broken is that instead of a smooth user flow where I redirect a user to Facebook and they get sent back, the user is stuck on the error page unless they think to refresh.
I've seen a bunch of posts saying that Facebook is very sensitive to the state parameter, but I'm using a vanilla alphanumeric (no special chars) and after refresh I get it back successfully.
The URL I'm seeing in FB while it is displaying the error looks like this:
https://www.facebook.com/dialog/oauth?client_id=<myAppId>&redirect_uri=https%3A%2F%2F<hostname>%2Ffbcallback&response_type=code&scope=public_profile&state=<18 character string>
I've checked that the URI is connected to the app profile in the Facebook developer page. Any clues? I don't know what this error means.
One discovery - if I try my flow in an incognito window where I'm not currently logged in to Facebook, everything works perfectly. If I then try to log into my app again, that's when I see the error. I'm not setting any cookies in my app, but it seems like there's some connection here.