如何使用带有guzzle 6+和laravel的instagram api?

时间:2016-05-28 07:57:06

标签: php laravel laravel-5.1 instagram-api guzzle

我正在尝试转换此网址https://api.instagram.com/v1/users/self/?access_token=123456789

我可以用guzzle一些东西。到目前为止我已经:

$token = "123456789";    
$client = new \GuzzleHttp\Client();
    $res = $client->request('GET', 'https://api.instagram.com/v1/users/self/', [
        'access_token' => $token
    ]);
    echo $res->getStatusCode();
    // 200
    echo $res->getHeaderLine('content-type');
    // 'application/json; charset=utf8'
    echo $res->getBody();
    // {"type":"User"...'

但我收到的错误是:

Client error: `GET https://api.instagram.com/v1/users/self/` resulted in a `400 BAD REQUEST` response:
{"meta": {"error_type": "OAuthParameterException", "code": 400, "error_message": "Missing client_id or access_token URL (truncated...)

1 个答案:

答案 0 :(得分:3)

您应该将您的令牌放在import Ember from 'ember'; export default Ember.Route.extend({ session: Ember.inject.service(), thing(params) { // Do some check and returns the result }, beforeModel (transition) { if (!this.thing(transition.params)) { transition.abort(); this.transitionTo('/login'); } } }); 中,如下所示:

query