Hi, I'm working on an Authentication v4 library with Angular 6. After creating successfully an Access Token to auhtenticate, I'm trying to delete it to deauthenticate, following https://developers.themoviedb.org/4/auth/delete-access-token.
Here is my code :
deleteAccessToken(accessToken): Observable<any> {
const body = {'access_token': accessToken};
const url = `http://api.themoviedb.org/4/auth/access_token`;
const httpOptions = {
body,
headers: new HttpHeaders({
'Content-Type': 'application/json;charset=utf-8',
'Authorization': 'Bearer my-bearer-access-token'
})
};
return this.http.request<any>('delete', url, httpOptions)
.pipe(
tap(res => console.log('res delete token : ', res)),
map(res => {
return res;
}),
catchError(this.handleError<any[]>('deleteAccessToken', [])),
);
}
I searched and tried a lot but I'm still stuck with a 404 error :
status_code: 37
status_message: "The requested session could not be found."
success: false
Does anyone has an idea of what's wrong ? :/
Regards,
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by Travis Bell
on October 11, 2018 at 10:13 AM
Are you encoding your request body as a JSON object?
Reply by Araes
on October 11, 2018 at 10:54 AM
Hi,
With a console.log(httpOptions) :
In my Network I see a Request Payload
Which is the same one that I get when I create the token
Regards,
Reply by leonardocabeza
on January 5, 2019 at 6:02 PM
Hi. This has been an issue to me as well, I'm trying it out from https://developers.themoviedb.org/4/auth/delete-access-token and get the same message error. Could you figure it out @Araes ?
Reply by yassineElmousaoui
on March 9, 2021 at 7:52 AM
hi did any of you figure this out ??
Reply by Peter Dzomlija
on October 4, 2021 at 9:31 AM
I'm in the process of building a Delphi (Pascal) implementation of The Movie DB API. Here is the code I'm prototyping to DELETE a v4 Access Token:
Here is the JSON Response that I get from the above:
The TNetHTTPClient.Delete method only has the means to receive data, and not send anything, which is why I added the Access Token to FUrl. The MovieDB v4 API documentation isn't very clear as to how an access token is actually to be deleted
Reply by Travis Bell
on October 5, 2021 at 3:56 PM
Hey guys,
I just pushed a small bugfix which should fix the issues you're seeing. If you need any more guidance, you can take a look at the following scripts. These are purely frontend HTML & JS so you can inspect the source code to see what's happening.
Cheers.
Reply by Peter Dzomlija
on October 5, 2021 at 11:18 PM
Thanks, Travis. I figured about as much that a fix was applied, because it started working as expected.
I still wish that there was a way using the v4 API to get a required Access Token in a similar manner that v3 can with Create Session with Login.