× Joomla Facebook Connect support forum

Topic-icon Redirection issues when forced to login page to authenticate

Support Specialist
This is split of the thread below for a site where user clicks on a link, which forces them to the login page, but then redirection doesn't bring them back to the proper page:
www.sourcecoast.com/forums/jfbconnect/jf...t/2631-redirect-loop?

Daniel,
I just got into the site to diagnose the current issues with JFBC4.0 that you're seeing. Immediately, on the front-end, I noticed multiple Javascript errors that were preventing me from logging in. In your template, I set the "Optimize JS" setting to "No", instead of "Join & Minify & Compress". That cleared up the issues in JFBConnect, as well as some others that weren't related to JFBConnect.

I can now successfully login. However, it does look like when I try to click any "Download" links, and am redirected to the login page, I'm not redirected back to the proper page when I click Login With Facebook.

Can you do a little testing, and let me know the following:
1) Do you have anything setup on your page to control redirects during logging in (other than JFBConnect's settings)? I can't figure out why I'm going to the page I'm going to when I login, and it doesn't always seem consistent. I think it's related to #2..
2) Please disable any caching you have enabled and test. I think the setting in the Global Config is part of the problem. If so, we can figure out a way around it, but would like more info on changes in behavior with that, and you know your site much better than us.

I'll need to check our code and figure out the best way to interpret the return variable in the URL when on the Login page to make sure we use that. Another user asked something similar, and with 4.0, it should be a lot easier to catch and use that variable.

Hope this helps get you started, and we'll get you fixed up soon.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
Hello Alex, thanks for the answer.

I disable all the cache´s, CSS and JS compress and now everything seems ok. The unique problem is the redirection now if a user is logued and try to download an file, he goes to a page to make the login just with the login form. But after the user use the JFBC, he´s redirected right to the login module page. I thinks this is right for the JFBC, it´s what the component need to make, but it´s not good for my client. Do you think there´s any way to solve this?

Thanks again and contratullations for the support.
The topic has been locked.
Support Specialist
Daniel,
Glad to hear mostly things are back on track. We're at Joomla Day Austin today, but have some ideas of how to implement the proper redirect to the originating page like you're looking to do. I'll try to get you something tomorrow, but it may not be till the weekend. I'm pretty confident though that we can get you something that works.. and even like the idea of looking to see if there is a 'return' variable in the URL and trying to use that in general.. so this may likely make it into a future release if we get something going that seems generic enough for most sites.

Thanks for your patience,
Alex
The topic has been locked.
Active Subscriptions:

None
Hello Alex, good night!

Congratulations again for the work. Wish you and JFBC guys a great Joomla day in Austin, it was a shame I could not have attended as we had here in Brazil, I hope that when you guys come to Joomla Day in Brazil I can go too.

Thanks for the support, if we can-do any thing here to help please just ask. These are great features for JFBC, and I'm sure it will continue to grow much.

Thank you again.

Best regards.
The topic has been locked.
Support Specialist
Daniel,
Just got into the site, and I think you're good to go. In the /components/com_jfbconnect/libraries/facebook.php file, at line 80, I modified the code as below:
$origReturn = JRequest::getVar('return', '');
        if ($origReturn != '')
           $return = base64_decode($origReturn);
        else
        {
        	$return = $uri->toString(array('path', 'query'));
        	if ($return == "")
            		$return = 'index.php';
	}

Basically, what it's doing is checking if there's already a variable called 'return' in the URL. If so, it's using that as where to redirect the user after they login. If not, we just use the current page, as expected.

It worked with my quick testing, but please let us know if you see any issues. This won't work with new users. Can probably figure out a good way to do that too... but lets take this step first, and let me know how it goes.

Good luck, and thanks for your patience,
Alex
The topic has been locked.
Active Subscriptions:

None
Perfect Alex, thanks a lot, now it´s working almost in the state of the art! JFBC is a sucess!

Best regards.
The topic has been locked.
Support Specialist
Daniel,
Whew! I can't tell you how very, very happy that makes me to hear. I added the change I made to our feature tracker as well. My guess is that we'll integrate it into the 4.1 release, because I don't seen any bad effects it should cause.. but we'll have to do a wider test on it. So, if we release any 4.0.x releases, you'll need to make the change, but then it should be included going forward.

Not sure why you say "almost in the state of the art"... hopefully you're not running into any other issues from JFBConnect, but if so, you know where to find us (I did see the other post about the Page Tab default).

Anyways, best of luck with your site, and JFBConnect. Finally, please consider leaving a rating and review of JFBConnect, or our support, on the Joomla Extension Directory. It definitely helps us out, but certainly isn't required.
extensions.joomla.org/extensions/social-...ook-integration/7215

Thanks,
Alex
The topic has been locked.