Twitter Oauth2 - 获取不记名令牌时出错 [英] Twitter Oauth2 - Error in obtaining the bearer token

查看:107
本文介绍了Twitter Oauth2 - 获取不记名令牌时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已遵循并仔细检查了从 https://dev 获取不记名令牌的步骤.twitter.com/oauth/application-only

I have followed and double checked the steps to get a bearer token from https://dev.twitter.com/oauth/application-only

我不断收到以下错误:
状态:403 禁止{"errors":[{"code":99,"message":"无法验证您的凭据","label":"authenticity_token_error"}]}

i keep getting the following error :
Status : 403 Forbidden {"errors":[{"code":99,"message":"Unable to verify your credentials","label":"authenticity_token_error"}]}

我尝试在正文和查询参数中传递 grant_type=client_credentials.

I tried passing grant_type=client_credentials in body as well as query parameter.

我点击的 URL 是:https://api.twitter.com/oauth2/token?grant_type=client_credentials

The URL i am hitting is : https://api.twitter.com/oauth2/token?grant_type=client_credentials

标题集:授权:基本 [base64encoded(client_key:client_secret)]内容类型:application/x-www-form-urlencoded;charset=UTF-8

Headers Set : Authorization : Basic [base64encoded(client_key:client_secret)] Content-Type : application/x-www-form-urlencoded;charset=UTF-8

我使用海报作为其余客户端来拨打电话.

I am using poster as the rest client to make the calls.

谁能指出我哪里出错了.

Could any one point out where i may be going wrong.

非常感谢.

推荐答案

发送grant_type=client_credentials"作为负载.

Send "grant_type=client_credentials" as the payload.

var options = {
    "method":"post",
    "headers": { 
      "Authorization":"Basic " + Utilities.base64Encode(param),
      "Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"
    },
    "payload" : "grant_type=client_credentials"
  };

  var response = UrlFetchApp.fetch(TOKEN_URL,options);

这篇关于Twitter Oauth2 - 获取不记名令牌时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆