Comments (16)
Hi @aammadullah! Thanks for submitting your issue. I'll take a look!
from pinterest-php.
Thanks for response, But I think this issue is from pinterest side because I have checked it through curl request and when I am changing code to an access token I am getting this response { "status": 403, "message": "Forbidden" }
So may be you can better know about this, So please have a look and inform me about the issue what you have understood so far.
Thanks!
from pinterest-php.
I've used the following script and did not encounter your error...
<?php
require_once 'vendor/autoload.php';
date_default_timezone_set('UTC');
use Pinterest\App\Scope;
$client = new \Pinterest\Http\BuzzClient();
$appId = 'myAppId';
$appSecret = 'myAppSecret';
$auth = new \Pinterest\Authentication($client, $appId, $appSecret);
$url = $auth->getAuthenticationUrl(
'https://localhost',
array(
Scope::READ_PUBLIC,
Scope::WRITE_PUBLIC,
Scope::READ_RELATIONSHIPS,
Scope::WRITE_RELATIONSHIPS,
),
'random-state'
);
/**
* 1. echo $url;
* 2. echo $auth->requestAccessToken('code');
* 3. $auth = \Pinterest\Authentication::onlyAccessToken(
* $client,
* 'accessToken'
* );
*
* $api = new \Pinterest\Api($auth);
* $response = $api->getUserFollowers();
* var_dump($response);
*/
That seems to work fine... I think you're missing something.
Could you copy / paste the code that you're using? Make sure to remove your app ID, app secret and access tokens.
from pinterest-php.
Did the code changed to an access token ?
from pinterest-php.
I'm not sure what you mean? Could you copy / paste the code that you're using, so I can take a look?
from pinterest-php.
from pinterest-php.
https://socialwebtool.com/pinterestApi/index.php?state=random-stringeri&code=dbedc77ef227de8d
Above is the link and below is the error
Fatal error: Uncaught Pinterest\Api\Exceptions\TokenMissing in /home/socialwe/public_html/pinterestApi/vendor/hansott/pinterest-php/src/Pinterest/Authentication.php:222 Stack trace: #0 /home/socialwe/public_html/pinterestApi/index.php(29): Pinterest\Authentication->requestAccessToken('dbedc77ef227de8...') #1 {main} thrown in /home/socialwe/public_html/pinterestApi/vendor/hansott/pinterest-php/src/Pinterest/Authentication.php on line 222
I will be very thankfull if you solved this
from pinterest-php.
You're code looks good. Can you copy / paste a var_dump
of $response
in https://github.com/hansott/pinterest-php/blob/master/src/Pinterest/Authentication.php#L216?
from pinterest-php.
object(Pinterest\Http\Response)#10 (6) { ["body"]=> object(stdClass)#11 (2) { ["status"]=> int(403) ["message"]=> string(9) "Forbidden" } ["statusCode":"Pinterest\Http\Response":private]=> int(403) ["rawBody":"Pinterest\Http\Response":private]=> string(41) "{ "status": 403, "message": "Forbidden" }" ["headers":"Pinterest\Http\Response":private]=> array(7) { ["Age"]=> string(1) "0" ["Cache-Control"]=> string(7) "private" ["Content-Type"]=> string(37) "application/javascript; charset=utf-8" ["X-Pinterest-RID"]=> string(12) "187749399847" ["Content-Length"]=> string(2) "41" ["Date"]=> string(29) "Fri, 14 Oct 2016 17:56:06 GMT" ["Connection"]=> string(10) "keep-alive" } ["result":"Pinterest\Http\Response":private]=> NULL ["request":"Pinterest\Http\Response":private]=> object(Pinterest\Http\Request)#7 (4) { ["method":"Pinterest\Http\Request":private]=> string(4) "POST" ["endpoint":"Pinterest\Http\Request":private]=> string(40) "https://api.pinterest.com/v1/oauth/token" ["params":"Pinterest\Http\Request":private]=> array(4) { ["grant_type"]=> string(18) "authorization_code" ["client_id"]=> string(19) "clientId" ["client_secret"]=> string(64) "clientSecret" ["code"]=> string(16) "code" } ["headers":"Pinterest\Http\Request":private]=> array(0) { } } }
from pinterest-php.
I've deleted your app ID and app secret from your comment.
from pinterest-php.
Ok thanks! I have forgotten
from pinterest-php.
Can you try it locally (not on server)? Use https://localhost as callback url. I think Pinterest blocks some IP addresses. Is your app hosted on Amazon?
from pinterest-php.
no its hosted on hostblast.net
I am trying on localhost thanks for the advice. I will be back
from pinterest-php.
What can I do then If they blocked my server IP ?
from pinterest-php.
You can contact them at https://developers.pinterest.com/support/contact.
I really think they are blocking your IP address, because you're code seems fine and it works for me. Thus you're error is probably not related to the library.
If you have any other questions, feel free the re-open.
Good luck!
from pinterest-php.
Thanks bro , Its working on localhost, And thanks for the advice brother
from pinterest-php.
Related Issues (20)
- Cannot Authorize Token from Code HOT 11
- Simple Question regarding "Follow a Board" and "Repin / Save a Pin" functions HOT 5
- Follow a board
- Unfollow a user
- Unfollow a board
- deletePin sprintf format causes data conversion and thus results in pin not found HOT 4
- Error - Operation timed out after 5000 milliseconds with 0 bytes received HOT 2
- Add docs for "Get the pins of authenticated user"
- Can not install package HOT 3
- Fatal error: Uncaught Pinterest\Http\Exceptions\RateLimitedReached: Rate limit reached. in HOT 2
- I get a token, but can't use $api in callback -- auth error HOT 1
- I can't get user info HOT 2
- Proxy Usage HOT 6
- Save (Re-Pin) a pin HOT 2
- $api->getUserBoards() suddenly failing HOT 4
- Malformed Json Error HOT 12
- how can be scheduled images to go live at a later date on pinterest using api in php? HOT 1
- ACCESS_TOKEN Pin Sharing HOT 2
- Upcoming v2 version of Pinterest API and the future of this package
- Parameter 'board' is required. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pinterest-php.