0
votes

I'm using the Trakt.tv api (http://docs.trakt.apiary.io) and attempting to scrobble a play. I'm using Oauth. I seem to be doing exactly what it says in the docs, but keep getting a fail.

My response from POST https://api-v2launch.trakt.tv/oauth/device/token after authorising my user is: {"access_token":"{{accesstoken}}","token_type":"bearer","expires_in":7776000,"refresh_token":"{{refreshtoken}}","scope":"public"}

I'm then passing the above access token to Trakt.tv (/scrobble/stop)

POST https://api-v2launch.trakt.tv/scrobble/stop trakt-api-version: 2 trakt-api-key: {{APIKey}} authorization: {{accesstoken}}

{"action": "scrobble","progress": 85, "episode": {"season": 1,"number": 1,"title": "Pilot","ids": {"trakt": 16,"tvdb": 349232,"imdb": "tt0959621","tmdb": 62085,"tvrage": 637041}},"show": {"title": "Breaking Bad","year": 2008,"ids": {"trakt": 1,"slug": "breaking-bad","tvdb": 81189,"imdb": "tt0903747","tmdb": 1396,"tvrage": 18164} }}

but keep getting the response of 401 WWW-Authenticate: Bearer realm="Doorkeeper", error="invalid_token", error_description="The access token is invalid"

Has anyone else used this API before successfully and can see anything I'm doing wrong? Thanks.

1

1 Answers

1
votes

It looks like you're missing the Bearer in the Authorization header. Example listed at http://docs.trakt.apiary.io/#introduction/required-headers