Hello i have a problem with my website intergrated with Facebook login. It used to work fine, the log in i mean but then i added more items in review (like and share) in the Facebook App and since then it doesn't redirect and doesnt login in my webiste

Dani AI

Generated

This looks like a classic OAuth redirect loop after changing app permissions. ’s flow shows Facebook returning a code but the browser ends up with a “too many redirects” message. The problem is usually in one of three places: the Facebook app settings (redirect URI / app mode), the server-side handling of the code → access token exchange, or a client/browser redirect loop caused by mismatched schemes (http/https) or cookies.

Practical checklist

  1. Verify the exact OAuth redirect URI in the Facebook app settings matches the redirect_uri you send to Facebook (scheme, host, path, and trailing slash must be identical).
  2. Confirm the app is in the correct mode: if you added permissions that require review and the app is not public, non-admin users will be blocked. Test using an admin/tester account or remove extra scopes while debugging.
  3. Inspect your server logic: when ?code= arrives, exchange it once for an access token, create the session, then stop re‑initiating the FB login redirect. A common bug is redirecting back to the login endpoint on token-exchange failure, causing a loop.
  4. Make sure your server can make outgoing HTTPS requests (curl or file_get_contents). Log the token-exchange HTTP status and response body to catch errors instead of silently redirecting.

Quick debug steps

  • Use the browser Network tab (or curl -I --location) to see the full 302 chain and find where the loop starts.
  • Add server-side logging for incoming requests to the login endpoint (query string, headers, timestamps).
  • Temporarily remove extra scopes (email only) to isolate permission-review issues.

Minimal handling pattern (pseudo-PHP)

if (isset($_GET['code'])) {
  // exchange code for access token (server-to-server)
  // on success: set session and redirect to dashboard
  // on failure: show an error (do not redirect back to FB login)
}

Note: ’s point about different HTTP clients is valid — if your token request never returns (timeout or blocked), your code might retry or redirect. As suggested, if the flow and logs show a platform-side error after all checks, escalate via Facebook’s developer tools.

Recommended Answers

All 6 Replies

Are you sure it stopped working at the exact time when you added more permissions?

Strangely, I used to use curl for Facebook OAuth, and suddenly that stopped working one day, and I had to switch to using file_get_contents().

Where do i find file_get_contents().

Looks like you're doing it a very different way than I did. I used OAuth.

i used OAUTH too. I dont know if this helps you tellin me what to do. Because i am sure there is nothing wrong with my app

The webpage at http://www.rovespier.com/facebook_login.php?code=AQA5XBoeSz0CqMXFjN4HYVGS8m9Ik7SbLiI0mcLCGfqYSfeuWJxspCJPE8vkUkgTEwOFR1WQUHH8C0IaBRNmP2z7a8qpGVl-p8OFd8XZwOcxkCuOGiFOiHwlYXaTuBTIZ3qdPR0j-usXpbRrfXe31ja7Vj0Tqm_2vGR1i5ABYDkVnP5erzBtdudSjqR9XAfUl6wOHqXQRr-hRFMG65690wv_7bHhpXtAQY3gg8wilW6AUFDxAxaeNpvG_rDcLT48T6AsFR5471hf8u4L6hLNMnYvfvwwzEjHM2g197HC3jDhUTnvorVR8qqcrt7UMYFFuOjkdTq9Q_8vpdfkLmuqawXi&state=f8be9ba734e1fd66215fa6824e4f1bab#= has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

Report a Login Issue to facebook :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.