fusionauth-typescript-client icon indicating copy to clipboard operation
fusionauth-typescript-client copied to clipboard

The host passed to the FusionAuthClient ctor must not end with a "/"

Open zadigus opened this issue 4 years ago • 4 comments

I've been tracking down that little bug for a few hours now, and finally I've found the problem. I have this code:

import { FusionAuthClient } from '@fusionauth/typescript-client'

const client = new FusionAuthClient(process.env.AUTH_API_KEY, process.env.AUTH_URL)

export const login = (user, password) => {
  return client.login({
    loginId: user,
    password,
    applicationId: process.env.AUTH_APP_ID
  })
}

I was not able to login with that code, because my AUTH_URL ended with a trailing /. In the application's console, I indeed can see that the FusionAuthClient sends its requests to the /api/login endpoint with two slashes in the address, i.e. something like this:

http://auth.shopozor//api/login

I would've expected such things to be handled by the client. Is that done like that by design or is that something you would consider fixing?

zadigus avatar May 24 '20 08:05 zadigus