Facebook redirect after login not working when url is dynamic

Posted by dythffvrb on Stack Overflow See other posts from Stack Overflow or by dythffvrb
Published on 2012-10-13T17:37:42Z Indexed on 2012/10/15 15:38 UTC
Read the original article Hit count: 268

This is my code:

$loginUrl = $facebook->getLoginUrl(array(
    'scope'         => 'publish_actions',
    'redirect_uri'  => 'http://mysite.com/',
    ));

It works but if I remove redirect_uri it doesn't work anymore.

$loginUrl = $facebook->getLoginUrl(array(
    'scope'         => 'publish_actions'
    ));

According to Facebook domcumentation redirect_uri is optional. https://developers.facebook.com/docs/reference/php/facebook-getLoginUrl/

Im trying to redirect the users to the same url they were on before logging in.

Update: This problem occurs when the url is mysite.com/post23 but when url is mysite.com/staticpage or mysite.com there are no problems

Any workarounds?

EDIT: It looks like a bug, it doesn't work with certain url in the same site

I wil try and report it to Facebook.

© Stack Overflow or respective owner

Related posts about php

Related posts about facebook