0

i’m wondering Why with this my access_token is not revoked when i use this in the logout button, can someone give some help please ?

revokeToken() {

    enter code here

   const httpOptions = {
      headers: new HttpHeaders({
      “Content-Type”: “application/x-www-form-urlencoded”,
      }),
   };
   const params: string = new HttpParams()
      .set("client_id", this.appConfig.getConfig().keycloakClientId)
      .set("client_secret", this.appConfig.getConfig().keycloakSecretId)
      .set("token", this.getToken())
      .set("token_type_hint", "access_token")
      .toString();

   return this._http.post(
      (this._revokeTokenUrl = `${
      this.appConfig.getConfig().keycloakUrl
      }/realms/${
      this.appConfig.getConfig().keycloakRealm
      }/protocol/openid-connect/revoke`),
      params,
      httpOptions
   );
}
i-23
  • 1
  • 1
  • I don't like the way you assign a value in a variable when calling `http.post`. This part : `this._http.post((this._revokeTokenUrl = `. Is it made on purpose ? Does it work ? Can you separate the variable, init it before the call to `post` then use it in `post` ? – Arnaud Denoyelle Mar 25 '22 at 13:31
  • 1
    My guess: you are not subscribing to the post observable. – R. Richards Mar 25 '22 at 13:33

0 Answers0