The Movie Database podpora

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 odpoveďí (na strane 1 z 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.

Nemôžeš nájsť film alebo seriál? Prihlás sa a pridaj ho.

Globálne

s zamerať sa na vyhľadávací riadok
p otvoriť menu profilu
esc zatvoriť otvorené okno
? otvoriť okno klávesových skratiek

Na média stránkach

b ísť späť (do rodičovského pokiaľ možno)
e íst na stránku úprav

Na stránkach seriálových serií

(pravá šípka) ísť na nasledujúcu sériu
(ľavá šípka) ísť na predchádzajúcu sériu

Na stránkach seriálových epizód

(pravá šípka) ísť na nasledujúcu epizódu
(ľavá šipka) isť na predchádzajúcu epizódu

Na všetkých obrázkových strankach

a otvoriť okno pre pridanie obrázku

Na všetkých stránkach úprav

t otvoriť výber prekladu
ctrl+ s odoslať formulár

Na stránkach diskusií

n vytvoriť novú diskusiu
w prepínač stavu pozerania
p prepínač verejný/súkromný
c prepínač zatvorený/otvorený
a otvoriť aktivitu
r odpovedať v diskusií
l ísť na poslednú odpoveď
ctrl+ enter odoslať vašu správu
(pravá šípka) nasledujúca strana
(ľavá šípka) predchádzajúca strana

Nastavenia

Chcete ohodnotiť alebo pridať túto položku do zoznamu?

Prihlásiť sa