Strange results connecting using phpSmug and oauth

LintLint Registered Users Posts: 27 Big grins
A quick question about whether anyone's noticed a difference between what phpSmug's images_get() returns when using different authorisation methods. I seem to be getting wildly different results when I use oauth as opposed to email/password. Essentially, results are correct with the former but very odd with the latter:
$f = new phpSmug("APIKey=<key>", "AppName=<myAPIname>" );
$f->login("EmailAddress=bing@bong.com", "Password=<password>" );
works
$f = new phpSmug("APIKey=<key>", "AppName=<myAPIname>", "OAuthSecret=<secret>" );
$f->setToken("id=<ID>", "Secret=<secret>");
comes back with what looks like a corrupted array.

help appreciated, ta.

Comments

  • LintLint Registered Users Posts: 27 Big grins
    edited November 7, 2010
    Got it. The two methods come back with two different versions of the API. mail/password is 1.2.0, oauth is 1.2.2. The APIver arg doesn't seem to have any effect.

    Not sure if this is a phpSmug thing or a smugmug thing but I'll pass the word on to Colin Seymour anyway and dig in a bit more if I get a moment.

    The problem comes about because the array returned by images.get is different between the two versions. The line:
    $images = ($f->APIVer == "1.2.2") ? $images['Images'] : $images;
    
    fixes the problem.

    Cheers all,

    K.
  • LintLint Registered Users Posts: 27 Big grins
    edited November 7, 2010
    My bad. ouath only supported in 1.2.2. I'll crawl back into my box now.

    sorry for the noise.
  • lildudelildude Registered Users Posts: 70 Big grins
    edited November 8, 2010
    Hi Lint

    Just replying here so others can see.

    First off, good to hear you've resolved the issue.

    As you pointed out, OAuth is only available with the 1.2.2 endpoint. Accordingly, phpSmug will force the use of this endpoint if you instantiate using the OAuthSecret argument indicating your intent to use OAuth.

    The differences in results is actually an API thing, and not phpSmug. The different endpoints return slightly different results.

    At one stage phpSmug did try and keep things uniform, but I changed that to try and keep phpSmug as close to the API documentation as possible.

    HTH
    Colin
  • LintLint Registered Users Posts: 27 Big grins
    edited November 8, 2010
Sign In or Register to comment.