小编soj*_*oju的帖子

Twitter api 版本 2 引发客户端禁止错误

当我尝试查询 Twitter 的最近搜索端点时,/2/tweets/search/recent它会引发异常

{
    "client_id": "xxxxx",
    "required_enrollment": "Standard Basic",
    "detail": "When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer app that is attached to a Project. You can create a project via the developer portal.",
    "registration_url": "https://developer.twitter.com/en/portal/opt-in",
    "title": "Client Forbidden",
    "reason": "client-not-enrolled",
    "type": "https://api.twitter.com/2/problems/client-forbidden"
}
Run Code Online (Sandbox Code Playgroud)

附加信息

授权 Oauth 1.0

签名方法 HMAC-SHA1

还提供消费者密钥、秘密、访问令牌、令牌秘密

为什么会这样?当我搜索此错误时,我没有得到任何有用的信息When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens …

twitter twitter-oauth

6
推荐指数
2
解决办法
957
查看次数

使用REST API在wordpress上传图像

使用rest api我可以创建一个帖子,获取博客类别等但我无法上传我引用的图像
https://github.com/WP-API/client-php/blob/master/library/WPAPI/Media.php

http://wp-api.org/#entities_media-meta_width

我的代码是

$data = array('file'=>$filePath,'is_image'=>true);
print_r($data);

$headers = array('Content-Type' => 'application/octet-stream');
$response = $this->api->post(WPAPI::ROUTE_MEDIA, $headers, $data);
Run Code Online (Sandbox Code Playgroud)

他们谈论[$ response in $ response = $ this-> api-> post(WPAPI :: ROUTE_MEDIA,$ headers,$ data);] $ data中使用的键值对是什么?

php wordpress

2
推荐指数
1
解决办法
4960
查看次数

Yii2 Rest Api 用户承载认证过期时间

我目前正在研究基于 yii2 的 Rest api。我使用不记名令牌进行用户身份验证。让我解释一下要求。

1)第一个用户使用他们的凭据从外部 php 应用程序进行身份验证。

2)他/她获得了一个访问令牌。

3) 使用此访问令牌发出每个后续请求。

public static function findIdentityByAccessToken($token, $type = null)
{
    return static::findOne(['auth_key' => $token]);
}
Run Code Online (Sandbox Code Playgroud)

这是我开始思考的地方。我没有找到访问令牌的任何过期时间。真的需要吗?如果是,我该如何存档?提前致谢。

yii2 yii2-api

2
推荐指数
1
解决办法
1506
查看次数

标签 统计

php ×1

twitter ×1

twitter-oauth ×1

wordpress ×1

yii2 ×1

yii2-api ×1