tumblr / tumblr.php

Tumblr API v2 PHP Client
Apache License 2.0
407 stars 115 forks source link

Unauthorized Tumblr\API\RequestException #84

Closed anuj9196 closed 7 years ago

anuj9196 commented 7 years ago

I have saved user's access_token and token_secret in database and using that to get user information

$tumblr = new \Tumblr\API\Client(TUMBLR_APP_ID, TUMBLR_APP_SECRET);
$tumblr->setToken($access_token, $token_secret);
$result = $tumblr->getUserInfo();

debug($result);

But this is giving exceptional error as

Unauthorized Tumblr\API\RequestException

Stack Tree is pointing tumblr/tumblr/lib/Tumblr/API/Client.php

line 387:         return $this->parseResponse($response);
ceyko commented 7 years ago

@anuj9196 It seems like your credentials are invalid. I just tested your sample with my creds and it works correctly.

I'd suggest checking your OAuth flow to ensure it is working properly. Or, if you're just looking for a static set of credentials for your user, you can login to the Tumblr API Console, grab your OAuth tokens from there, and plug them into this script.

Edit: Note that if a user has revoked your application, then you will also see an Unauthorized error.