My WebApp (using facebook login) logs me out -


i use facebook login on website

window.fbasyncinit = function() {      // init fb js sdk     fb.init({       appid      : 'xxx', // app id app dashboard       channelurl : 'xxx/channel.php', // channel file x-domain communication       cookie     : true, // set sessions cookies allow server access session?       frictionlessrequests: true     });  }; 

the problem is, logged out on website every ~10-20min. site reloading , i'm logged in again. think cookies gets deleted somehow.

is there way make cookie exist longer?

my login looks that:

fb.login(function(response) {}, {scope:'publish_actions'}); 

update:

this part of script called when user logs in first time:

// triggers on first login if (isset($_get['first_login'])) {     if ($me) {         $facebook->setextendedaccesstoken();         $friends = $facebook->api('/me/friends');         $friends = $friends['data'];         if (!empty($friends)) {             // sql          }         $permissions = $facebook->api("/me/permissions");          if( array_key_exists('publish_actions', $permissions['data'][0]) ) {             $attachment = array(                     'message' => 'xxx',                     'name' => 'xxx - app',                     'link' => 'xxx',                     'description' => 'xxx',                     'picture'=> 'xxx',                     'access_token' =>  $facebook->getaccesstoken()             );             $facebook->api('/'.$facebook->getuser().'/feed', 'post', $attachment);              // sql         }         header('location: http:/xxx');     } } 

but error

fatal error: uncaught oauthexception: (#1) error occured while creating share thrown in /facebook/base_facebook.php on line 1254

which caused $facebook->api('/'.$facebook->getuser().'/feed', 'post', $attachment);

when remove link-attribute $attachment, works. link attribute forbidden or something?

you should extending facebook access tokens

https://developers.facebook.com/docs/howtos/login/extending-tokens/

however uses app secret should not done in javascript in server side language (possibly combining code php-sdk)


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

ios - iPhone/iPad different view orientations in different views , and apple approval process -

Shrink a YouTube video to responsive width -