Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.logout("refreshtokien here") dont work #79

Open
IzydorDPS opened this issue Oct 2, 2022 · 2 comments
Open

client.logout("refreshtokien here") dont work #79

IzydorDPS opened this issue Oct 2, 2022 · 2 comments

Comments

@IzydorDPS
Copy link

IzydorDPS commented Oct 2, 2022

i was forced to replace method above with client.logoutWithRequest(logoutRequest); witch is basicly the same so it dont change anything but its still a bug

problem:
when calling client.logout(true, "refreshtokien here") i get exception that api consumes only application/json but api sends plain/text
method:

image

exception:

{
  "statusCode": 400,
  "exception": {
    "fieldErrors": {},
    "generalErrors": [
      {
        "code": "[InvalidContentType]",
        "message": "Invalid [Content-Type] HTTP request header value of [text/plain]. Supported values for this request include [application/json]."
      }
    ]
  }
}
@robotdan
Copy link
Member

robotdan commented Oct 3, 2022

If you omit the Content-Type request header, does it work ok?

I think the issue is in our builder, I think this was a carry over from native JavaScript where the browser doesn't want to make a POST request w/out a content type header. But I don't think we need this in TypeScript.

https://github.com/FusionAuth/fusionauth-client-builder/blob/5ec210211dac37cdb314dd0e7cd132b2165f04af/src/main/client/typescript.client.ftl#L93

@impact-erik
Copy link

Same issue here. I have done this

const client = new FusionAuthClient(key, url);
const clientBuilder = client.clientBuilder.build(url);
clientBuilder
      .withHeader('Content-Type', 'application/json') // this is the override
      .withUri('/api/logout')
      .withParameter('global', true)
      .withParameter('refreshToken', refreshToken)
      .withMethod('POST')
      .go()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants