PHP Photobucket " Exception Insufficient permissions"

681 Views Asked by At

Thanks for looking at my code. I am getting Insufficient permissions exception from photobucket. I have put my code snippet below:

try {
    $key = '45435xxxx';
    $sec = 'xxxx98989';
    $api = new PBAPI($key, $sec);

    $api->login('request')->post()->loadTokenFromResponse();

    /*----- authToken and oauth_token_secret-------*/
    $authToken=$api->getOAuthToken()->getKey();
    $oauth_token_secret=$api->getOAuthToken()->getSecret();


    /*--Autehnication--*/
    $api->setOAuthToken($authToken, $oauth_token_secret,"ricolifts");
    $api->setResponseParser('simplexml');

    $response = $api->album('testalbum')->upload(array('type' => 'image', 'uploadfile' => '@'.$path, 'title' => 'my upload'))->post()->getResponseString();
    var_dump($response);

} 
catch (PBAPI_Exception_Response $e) {

    echo "RESPONSE $e";
} 
catch (PBAPI_Exception $e) {

    echo "EX $e";
}

The error I am getting is: Exception Insufficient permissions 9 xml POST 1328766775

Please help me. What I am missing or what is wrong with my code. Am I missing a parameter to the upload function? Is there some other authentication I missing ? Any role of subdomain ? Can I use temp as album name? I appreciate in advance. Thanks again

1

There are 1 best solutions below

1
Justin On

I'm the developer of the Photobucket API code you're using.

You've got a Request token there. You need to go through the web authentication process to have a user input their username and password in photobucket, and exchange that request token for an access token.

See the simple_demo.php https://bitbucket.org/photobucket/api-php5-pear/src/1b31215ab83e/simple_demo.php for an example of how this works with that library.