dirkgroenen / pinterest-api-php

A PHP wrapper for the official Pinterest API. :pushpin:
https://developers.pinterest.com/docs/getting-started/introduction/
Apache License 2.0
173 stars 76 forks source link

Getting auth token is not working #7

Closed albertleao closed 8 years ago

albertleao commented 8 years ago

Hello. I've been following your Auth flow and have gotten stuck on a piece. I have pinterest redirecting back to my app with an access_token in the url. When I pass this access_token into the $pinterest->auth->getOAuthToken($code) function, I get the following error.

An uncaught Exception was encountered

Type: DirkGroenen\Pinterest\Exceptions\PinterestException

Message: Pinterest error (code: 404) with message: 404: Not Found

Filename: /var/www/dev/vendor/dirkgroenen/pinterest-api-php/src/Pinterest/Transport/Request.php

Line Number: 193
dirkgroenen commented 8 years ago

As you can read in the README you don't have to get an access_token through the getOauthToken() request:

At this moment the Pinterest API returns the user's access_token in the query string on the callback page. The documentation states that this should be a code, so the next method has been writing assuming this will be changed somewhere in the future

Try using the access_token returned by Pinterest and you should be ready to go.