如何使用Twitter提供的令牌/秘密将推文发布到我自己的Twitter应用程序中?

时间:2014-01-09 03:57:46

标签: php twitter oauth twitter-oauth

使用OAuth验证其他用户是否代表他们发送推文我没有问题,但在将推文发送到我自己的时间轴时,我正在绘制一个COMPLETE空白。

我们的身份验证设置如下:

enter image description here

Twitter在此处提供您的访问令牌和访问令牌密钥:

enter image description here

但是,在使用我们的消费者密钥和密钥创建客户端并尝试使用访问令牌/机密进行发布后,我一直收到访问令牌已过期的错误

任何人都可以帮忙解释一下吗?我需要做些什么才能让我的网络应用将推文发布到我自己的Twitter时间线上?

编辑:更新

这是我从我的请求中得到的回复:

object(HttpResponse) {
    body => '{"errors":[{"message":"Invalid or expired token","code":89}]}'
    headers => array(
        'content-length' => '61',
        'content-type' => 'application/json; charset=utf-8',
        'date' => 'Thu, 09 Jan 2014 04:16:41 UTC',
        'server' => 'tfe',
        'set-cookie' => 'guest_id=v1%3A138924100123005834; Domain=.twitter.com; Path=/; Expires=Sat, 09-Jan-2016 04:16:41 UTC',
        'strict-transport-security' => 'max-age=631138519',
        'Connection' => 'close'
    )
    cookies => array(
        'guest_id' => array(
            'value' => 'v1%3A138924100123005834',
            'domain' => '.twitter.com',
            'path' => '/',
            'expires' => 'Sat, 09-Jan-2016 04:16:41 UTC'
        )
    )
    httpVersion => 'HTTP/1.1'
    code => '401'
    reasonPhrase => 'Unauthorized'
    raw => 'HTTP/1.1 401 Unauthorized
content-length: 61
content-type: application/json; charset=utf-8
date: Thu, 09 Jan 2014 04:16:41 UTC
server: tfe
set-cookie: guest_id=v1%3A138924100123005834; Domain=.twitter.com; Path=/; Expires=Sat, 09-Jan-2016 04:16:41 UTC
strict-transport-security: max-age=631138519
Connection: close

{"errors":[{"message":"Invalid or expired token","code":89}]}'
}

1 个答案:

答案 0 :(得分:0)

我发现了这个问题,显然我在重新启动应用程序进行读/写而不仅仅是读取之后,没有更新我的所有令牌的新手错误。