Nerzal/gocloak

Failing to set custom Token endpoint

ytanne opened this issue · 2 comments

ytanne commented

Describe the bug
I am failing to set custom token endpoint.

To Reproduce
Steps to reproduce the behavior:

  1. Create new client:
// values are just examples
hostname = "https://test.domain"
customEndpoint = "test/path/to/token"

client := gocloak.NewClient(hostname, gocloak.SetTokenEndpoint(customEndpoint))
token, err := client.LoginClient(context.Background(), username, password, realm)
if err != nil {
    log.Println(err)
    os.Exit(1)
}
  1. Run:
go run test.go
  1. Observe output:
404 Not Found: RESTEASY003210: Could not find resource for full path: https://test.domain/realms//test/path/to/token

Expected behavior
I expect to get the token

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS:
    Operating System: Linux Mint 21.2
    Kernel: Linux 5.15.0-89-generic
    Architecture: x86-64
  • Version of the gocloak:
    github.com/Nerzal/gocloak/v13 v13.8.0
Nerzal commented

What keycloak version are u using?

ytanne commented

I have found the source of the issue. The realm that I was passing was empty. Anyway, I wonder why you use strings.Join in makeURL instead of url.JoinPath?