Oauth problem with shell script

Hi to all,

I’m having problems with script that i’m making using PHP-SDK from facebook version 3.1.

Here is the situation I’m the user and i gave my app this permissions :


[0] => Array
                (
                    [status_update] => 1
                    [photo_upload] => 1
                    [video_upload] => 1
                    [offline_access] => 1
                    [email] => 1
                    [create_note] => 1
                    [share_item] => 1
                    [bookmarked] => 1
                    [read_stream] => 1
                    [publish_stream] => 1
                    [user_birthday] => 1
                    [user_activities] => 1
                    [user_photos] => 1
                    [user_videos] => 1
                    [user_photo_video_tags] => 1
                    [user_notes] => 1
                    [user_checkins] => 1
                    [user_status] => 1
                )

Now simple script is this …


$facebook = new Facebook(array(
			'appId'  => *******,
			'secret' => *************,
			'cookie' => true,
		));

$albums =  $this->facebook_api->api('/MYUSER_ID/albums');
print_r($albums);

When i check this from web ->facebook -> my app tab it works perfectly but when i try to run this script from shell it gives me an error :


shell script PHP Fatal error:  Uncaught OAuthException: An access token is required to reques t this resource.

Strange thing is if i use fql.query for
“SELECT aid,cover_pid, name, created, modified, description FROM album WHERE owner = MYUSER_ID”; it returns results without problem!

WHY?? I know it’s access token, but as i understood my app has offline permissions it should work right?

Help please :*

Are you storing the access token to use in your auth request?

p.s. that’s a scary long permission list

Look that app is ment only for one user, so list of permissions is really not a problem :slight_smile:
Auth token is problem … as i understand … to generate token this is process :

  1. script redirects to oauth/authorization with client id and redirect_url
  2. authorization sends you on your redirect_url with access code

This is impossible with shell script because i don’t have $_REQUEST, but i can avoid this with generating auth_token but my problem is auth token doesn’t last long and i need this tu run for a long period on a remote machine i can’t enter access_token every couple of days.