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,
Kan du ikke finde en film eller TV-serie? Log in og opret den.
Want to rate or add this item to a list?
Ikke medlem?
Svar af Travis Bell
d. 11 oktober 2018 kl. 10:13 AM
Are you encoding your request body as a JSON object?
Svar af Araes
d. 11 oktober 2018 kl. 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,
Svar af leonardocabeza
d. 5 januar 2019 kl. 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 ?
Svar af yassineElmousaoui
d. 9 marts 2021 kl. 7:52 AM
hi did any of you figure this out ??
Svar af Peter Dzomlija
d. 4 oktober 2021 kl. 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
Svar af Travis Bell
d. 5 oktober 2021 kl. 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.
Svar af Peter Dzomlija
d. 5 oktober 2021 kl. 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.