【问题标题】:Getting error "invalid_client" from Vimeo API on user authentication从 Vimeo API 获取用户身份验证错误“invalid_client”
【发布时间】:2017-03-10 15:32:36
【问题描述】:

我正在尝试通过 Vimeo 对用户进行身份验证,以便在网站上查看他们的视频列表。

我正在使用 Vimeo php 库 https://github.com/vimeo/vimeo.php 在我的代码中包含它时没有错误。

我获得了身份验证 URL,并且能够导航到 Vimeo 上的“允许 APP 访问”页面,当我单击“允许”时,我的重定向页面上出现“invalid_client”错误,即使他们发回了代码$_GET。

我现在完全糊涂了,因为我有官方的 API 库,并且据我所知,APP 设置正确。我希望有人能指出我为什么会收到此错误以及如何解决它的正确方向!

我的代码:

//init Vimeo
require_once("modules/classes/Vimeo/autoload.php");
$lib = new \Vimeo\Vimeo($vimeo_id, $vimeo_secret, $vimeo_access);

if(!isset($_SESSION['vstate'])){
    $_SESSION['vstate'] = base64_encode(openssl_random_pseudo_bytes(30));
}
$vimeo_authurl = $lib->buildAuthorizationEndpoint($redirecturi,'public private',$_SESSION['vstate']);

if(isset($_GET['code'])){

    echo "Code returned: ".$_GET['code'];

    if ($_SESSION['vstate'] != $_GET['state']) {
        echo 'Something is wrong. Vimeo sent back a different state than this script was expecting. Please let an administrator know that this has happened.';
    }

    $tokens = $lib->accessToken($_GET['code'], $redirecturi);
    if ($tokens['status'] == 200) {
        echo 'Vimeo account successfully connected!';
        $_SESSION['access_token'] = $tokens['body']['access_token'];
        $lib->setToken($token['body']['access_token']);
    } else {
        echo 'Sorry, we were unable to connect to your Vimeo account due to the following error:<br/>{'.$tokens['body']['error']."} ".$tokens['body']['error_description'];
    }

    echo "<br/><br/><pre>";
    print_r($tokens);
    echo "</pre>";

    exit();

}

print_r($tokens) 给出了这个:

Array
(
[body] => Array
    (
        [error] => invalid_client
        [error_description] => A valid client ID must be provided along with any request made to Vimeo's API
    )

[status] => 400
[headers] => Array
    (
        [Server] => nginx
        [Content-Type] => application/json
        [Expires] => Fri, 10 Mar 2017 03:11:17 GMT
        [Cache-Control] => no-store
        [Strict-Transport-Security] => max-age=15552000; includeSubDomains; preload
        [Pragma] => no-cache
        [X-UA-Compatible] => IE=edge
        [X-XSS-Protection] => 1; mode=block
        [X-Content-Type-Options] => nosniff
        [X-Frame-Options] => sameorigin
        [Content-Security-Policy-Report-Only] => default-src https: data: blob: 'unsafe-inline' 'unsafe-eval'; report-uri /_csp
        [Accept-Ranges] => bytes
        [Via] => 1.1 varnish
        [Fastly-Debug-Digest] => 5da2a3ac863afd5f2ad0963779e0dbc4c54c7d97d19f87fd227c5eb8c92bd621
        [Content-Length] => 126
        [Date] => Fri, 10 Mar 2017 15:11:17 GMT
        [Connection] => keep-alive
        [X-Served-By] => cache-iad2146-IAD, cache-ord1731-ORD
        [X-Cache] => MISS, MISS
        [X-Cache-Hits] => 0, 0
        [X-Timer] => S1489158677.346607,VS0,VE55
        [Vary] => Accept,Vimeo-Client-Id,Accept-Encoding,User-Agent
    )
)

【问题讨论】:

    标签: php vimeo


    【解决方案1】:

    所以我不完全确定为什么,但我创建了一个具有相同细节的新 APP,并且这个新 APP 似乎验证正常。

    我遇到问题的第一个 APP 我最初发送了上传访问请求,但被拒绝(由于本地测试链接),所以这可能是“invalid_client”错误的根本问题。

    【讨论】:

    • 我建议直接联系 Vimeo 以尝试确定发生了什么。在您给他们的消息中引用此 StackOverflow 线程:help.vimeo.com 点击顶部的“联系我们”。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-24
    • 1970-01-01
    • 1970-01-01
    • 2016-04-12
    • 2018-10-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多