Pankaj Khurana
Pankaj Khurana

Reputation: 3271

How do i hide session information from url after successful authentication through facebook connect?

I am using facebook connect in one of my website. For this i have used php sdk library.

I am using following code:

<?php
  require APP_PHYSICAL_PATH.'includefiles.php';
  $loginUrl = $facebook->getLoginUrl(
        array(
        'req_perms' => 'email,user_location',
        'next'=>APP_URL.'views/search.php?validate=true'

        )
);
?>  
   <a href="<?php echo $loginUrl; ?>">
    <img src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif">
  </a>

The problem is that after successful authentication it goes to search page but it shows session information in the url. For e.g.

http://mydomain/views/search.php?validate=true&session={"session_key"%1A"4.7REQluh3EVBGKiA5m8cNlg__.6600.1700968000-900001178893860"%  

I want that this session information should not be visible. Is there any way to accomplish this?

Please help me on this

Thanks

Pankaj

Upvotes: 0

Views: 1107

Answers (1)

Imi Borbas
Imi Borbas

Reputation: 3703

My solution to this problem was the following:

  • When the user clicks the Facebook login button, a popup window appears (preferably without the URL input bar). Also, you can pass a 'display' => 'popup' parameter to the getLoginUrl method, as this will use another layout for the Facebook connect page which is more suitable for popup windows.
  • When the Facebook login and permission granting is successful, Facebook redirects you to that URL you don't want to show.
  • On the page you're redirected to, you should echo a javascript which closes the window.

Another solution would be to do this entire connect stuff inside an iframe (though I haven't tested this approach).

Upvotes: 2

Related Questions