Facebook OAuth2 - "Sorry, something went wrong"
Asked Answered
E

6

10

Our web app allows users to log in via Facebook. Technically, we are using Facebook OAuth2. We have implemented this login process two years ago. It worked fine until 13th November 2015 but since that day it does not. When our server sends the request https://graph.facebook.com/oauth/access_token with appropriate parameters (client_id, redirect_uri, client_secret, code), the response from Facebook has HTTP status 400. The response body is a HTML page saying "Sorry, something went wrong".

On 13th November, there was some problem on Facebook probably. I have found the following message: http://www.independent.co.uk/life-style/gadgets-and-tech/news/facebook-down-site-breaks-for-many-people-though-not-for-everyone-a6732906.html

However, our server still gets this error response after a week. We have an instance of the system deployed in the production environment and one more instance in the test environment (with different Facebook account, i.e. with different client_id and client_secret). Currently, Facebook login works fine in the test environment. I am not sure if it worked on 13th November.

Do you have any experience with recovery from such problem? Why does Facebook login work in test environment and does not work in the production environment in the same app? Why did the production instance break on a particular day and is still broken a week later?

Thanks for any help.

Exogamy answered 20/11, 2015 at 9:10 Comment(0)
E
0

Finally, the issue was resolved by restarting the servlet container (Tomcat 7). However, I have no idea why.

Exogamy answered 23/11, 2015 at 12:12 Comment(3)
Did you ever found out why? I'm having exactly the same problem with ionic and a node server. It works in my testing environment, but i move it to my server and gives me the "Something went wrong" message.Moffit
I think I figured it out. Were you developing on a mobile site with Chrome debugging tools? I just added a new answerObrian
@Obrian I don't remember the details after such long time. I use nearly always Firefox for debugging however.Exogamy
C
21

I had the same issue. I believe that the issue stems from passing in invalid scope in your authentication requests. Try removing the scopes in your authentication request to see if that works.

Cavallaro answered 15/9, 2020 at 17:2 Comment(4)
Can you add this as comment?Eversole
Just having scope: openid resolved my issue. (Removed email profile). However I could see an another issue with token endpoint not available in facebook openid configurationHowze
Seems like there was a change, used to work with scope=email&manage_pages, going to just email fixed it.Forsyth
See facebook's documentation on app types. You'll hit this if your app asks for a permission that is not allowed for its app type. (Example: Business apps can't get the user_posts permission). See developers.facebook.com/docs/development/create-an-app/…Kandace
H
4

One more corner case I found in 2022: In the App Dashboard, if you choose Facebook login for Business, same error happens. It will go away as soon as you select Facebook Login one.

Hero answered 19/1, 2023 at 15:24 Comment(1)
Same issue here, the error was simply a 500 error in the popup with no details or explanation -- and Facebook appears to be automatically migrating new apps to use "Facebook login for Business". I had to select the "switch back to Facebook Login" option.Ephrayim
C
2

In my case, I had overlooked setting the email permission initially. However, once I configured the necessary permission for email access, the redirect functionality started working as expected.enter image description here

Carline answered 21/1 at 23:12 Comment(0)
E
0

Finally, the issue was resolved by restarting the servlet container (Tomcat 7). However, I have no idea why.

Exogamy answered 23/11, 2015 at 12:12 Comment(3)
Did you ever found out why? I'm having exactly the same problem with ionic and a node server. It works in my testing environment, but i move it to my server and gives me the "Something went wrong" message.Moffit
I think I figured it out. Were you developing on a mobile site with Chrome debugging tools? I just added a new answerObrian
@Obrian I don't remember the details after such long time. I use nearly always Firefox for debugging however.Exogamy
O
0

All of this is using exclusively the login button. Not the API serverside and not FB.login(). It would work for me sometimes and sometimes not and I couldn't figure out why. I would open a new window and it may work, or may not - but it seemed like once broken it was broken.

There appears to be an issue when using the Chrome 'Device simulator'.

Looking at the SDK Javascript (that's to say the SDK that the Facebook Login button uses) it checks to see if the device is a 'touch' device and if so it will use the m.facebook.com domain when requesting the oauth token.

This domain fails m.facebook.com:

enter image description here

However if the mobile device mode isn't activated when the page loads then it uses www.facebook.com and succeeds:

enter image description here

So for me the current workaround is:

  • Assuming you are developing with the console active.
  • When you need to reload your page press Ctrl + Shift + M to deactivate the mobile device mode.
  • Refresh the page
  • Once the button has initialized press Ctrl + Shift + M to reactivate it again.
  • If you see m.facebook.com then you didn't do it fast enough, or maybe you're using something like Angular with hot reload and you need to manually refresh.
Obrian answered 7/12, 2018 at 3:51 Comment(1)
i have same issue, got any solution ?Bechtold
N
0

I fixed the issue by simply removing or adjusting the scope and the problem was solved for me. So try adjusting or removing your scope.

Nabila answered 6/12, 2023 at 5:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.