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-

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 ) {
, 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 := “”

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)


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

@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 (

func main() {
  config := okta.NewConfig().WithOrgUrl("").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 {