我正在使用Trakt.tv api(http://docs.trakt.apiary.io)并尝试对游戏进行捣乱。 我正在使用Oauth。我似乎完全按照文档中的说法进行操作,但不断失败。
授权我的用户后,来自POST https://api-v2launch.trakt.tv/oauth/device/token的回复是: {"的access_token":" {{的accessToken}}"" token_type":"承载"" expires_in" :7776000," refresh_token":" {{refreshtoken}}""范围":"公共"}
然后我将上述访问令牌传递给Trakt.tv(/ scrobble / stop)
POST https://api-v2launch.trakt.tv/scrobble/stop trakt-api-version:2 trakt-api-key:{{APIKey}} 授权:{{accesstoken}}
{" action":" scrobble"," progress":85," episode":{" season&#34 ;:1,"数字":1,"标题":"飞行员"," ids":{" trakt&#34 ;:16," tvdb":349232," imdb":" tt0959621"," tmdb":62085," tvrage&# 34;:637041}}," show":{" title":" Breaking Bad"," year":2008,&#34 ; ids":{" trakt":1," slug":" break-bad"," tvdb":81189,& #34; imdb":" tt0903747"," tmdb":1396," tvrage":18164}}}
但继续得到401的回复 WWW-Authenticate:Bearer realm =" Doorkeeper",error =" invalid_token",error_description ="访问令牌无效"
有没有其他人在成功之前使用过这个API,可以看到我做错了什么?感谢。
答案 0 :(得分:1)
您似乎错过了Bearer
标题中的Authorization
。在http://docs.trakt.apiary.io/#introduction/required-headers