通过Auth0访问Twitter API后验证

时间:2016-09-07 10:57:57

标签: twitter access-token auth0

我已通过Auth0成功获得了access_token帖子的Twitter身份验证。我试图在标题中使用该access_token但是从Twitter获得401错误。

  $http.defaults.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('twitter_access_token');        

  $http.jsonp('https://api.twitter.com/1.1/statuses/user_timeline.json?callback=JSON_CALLBACK').then(
        function (response) {
            console.log(response);
        },
        function (response) {
            console.log(response);
        }
    );

请问我做错了什么?

1 个答案:

答案 0 :(得分:1)

您可能正在使用Auth0自己的访问令牌。您必须首先获得Twitter访问令牌,如此处所述=> https://auth0.com/docs/tutorials/calling-an-external-idp-api