Getting users api in okta-sdk-golang to work

From my backend, I want to list all users for my org( simple stuff).
If I try the following code as seen from okta sdk example, I get an API error with no stack trace or even the API name(have tried setepping through code)

myClient := &http.Client{}
config := okta.NewConfig().WithOrgUrl("https://dev-

/oauth2/default").WithToken("-----")
client := okta.NewClient(config, myClient, nil)

client := core.NewClient()
if(client == nil) {
fmt.Println(“client is null”)
}

fmt.Print(" users: ", *(client.User))
filter := query.NewQueryParams(query.WithFilter(“status eq “ACTIVE””))
users, , err := client.User.ListUsers(filter)
if( err!= nil ) {
println(err.Error())
}
for
, u := range users {
fmt.Print(“user id: %v”, u.Id)
}

I can use the below code to access the endpoint directly though and get the expected response.

url := “https://----------oktapreview.com/api/v1/users”

req, _ := http.NewRequest(“GET”, url, nil)

req.Header.Add(“Accept”, “application/json”)
req.Header.Add(“Content-Type”, “application/json”)
req.Header.Add(“Authorization”, “SSWS --------------”)
req.Header.Add(“cache-control”, “no-cache”)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

Any idea what I could be doing wrong while using the okta sdk directly ?
Thanks

@rimaram: the big thing is to make sure you’re only using your Okta org root URL, not the OAuth endpoint. Below is a package that works if you replace the subdomain and token with your own:

package main

import (
  "fmt"
  "github.com/okta/okta-sdk-golang/okta"
  "github.com/okta/okta-sdk-golang/okta/query"
)

func main() {
  config := okta.NewConfig().WithOrgUrl("https://YOUR_SUBDOMAIN.okta.com").WithToken("YOUR_API_TOKEN")
  client := okta.NewClient(config, nil, nil)
  filter := query.NewQueryParams(query.WithFilter("status eq \"ACTIVE\""))
  users, _, _ := client.User.ListUsers(filter)
  for _, user := range users {
    fmt.Println(user.Id)
  }
}