The Movie Database support

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,

7 svar (på side 1 af 1)

Jump to last post

Are you encoding your request body as a JSON object?

Hi,

With a console.log(httpOptions) :

body: {access_token: "my-access-token"}

In my Network I see a Request Payload

access_token: "my-access-token"

Which is the same one that I get when I create the token

Regards,

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 ?

hi did any of you figure this out ??

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:

procedure TFormJSONMain.ButtonMovieDB_V4AuthSessionIDClick(Sender: TObject);
var
  AHTTPResponse:TStringStream;
  HTTP:TNetHTTPClient;
  FUrl: string;
begin
  AHTTPResponse := TStringStream.Create;
  HTTP := TNetHTTPClient.Create(nil);
  try
    HTTP.Asynchronous := False;
    HTTP.ConnectionTimeout := 10000;
    HTTP.ResponseTimeout := 10000;
    HTTP.AllowCookies := True;
    HTTP.HandleRedirects := False;
    HTTP.UserAgent := 'Embarcadero URI Client/1.0';

    HTTP.ContentType := 'application/json;charset=utf-8';
    HTTP.AcceptLanguage := 'en-US';
    HTTP.CustomHeaders['Authorization'] := Format('Bearer %s', [MOVIEDB_API4_READ_ACCESS_TOKEN]);

    FUrl := CreateAccessTokenV4_URL+Format('&access_token=%s', [USER_ACCESS_TOKEN]);
    HTTP.Delete(FUrl, AHTTPResponse);
  finally
    HTTP.Free;
    AHTTPResponse.Free;
  end;
end;

Here is the JSON Response that I get from the above:

{
"status_code":37,
"status_message":"The requested session could not be found.",
"success":false
}

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

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.

@travisbell said:

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.

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.

Kan du ikke finde en film eller TV-serie? Log in og opret den.

Global

s focus the search bar
p open profile menu
esc luk et åbent vindue
? open keyboard shortcut window

På mediesider

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

På alle billedesider

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

På diskussionssider

n opret ny diskussion
w toggle watching status
p toggle public/private
c toggle close/open
a åben aktivitet
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Indstillinger

Want to rate or add this item to a list?

Log ind