Search code examples
angularopenid-connect

Invalid response content-type on logout with oidc-client-ts in Angular


I am trying to connect to a new OAuth Identity Provider from my Angular app. The logout is implemented with an userManager.signoutRedirect() call to UserManager provided by oidc-client-ts.

Logout works well with my old Identity Provider, where the /token/revocation endpoint called under the hood returns without Content-Type header (Content-Length is 0) But the new OAuth server returns the Content-Type: text/plain; charset=utf-8 header (still without actual content), which results in the following error:

ERROR Error: Invalid response Content-Type: text/plain; charset=utf-8, from URL: .../token/revocation.

The response status is 200 OK.

Is there a way I can set the Accept header on my logout request with the oidc-client-ts library, or any other fix for this issue?


Solution

  • I've found the solution at https://github.com/authts/oidc-client-ts/issues/1650.

    There is a parameter which can be set in the UserManagerSettings:

    const settings: UserManagerSettings = {
        authority: ...,
        client_id: ...,
        redirect_uri: ..., 
        revokeTokenAdditionalContentTypes: ['text/plain; charset=utf-8'],
    };