I'm unable to workout how to get the Ory client in...
# general
c
I'm unable to workout how to get the Ory client in Go working...
Copy code
func main() {
    ctx := context.Background()

    cfg := client.NewConfiguration()
    cfg.Debug = true
    c := client.NewAPIClient(cfg)

    auth := context.WithValue(ctx, client.ContextAccessToken, "[redacted]")

    result, _, err := c.IdentityAPI.ListIdentities(auth).Execute()
    if err != nil {
       slog.With("error", err).Error("error getting identities")
       os.Exit(1)
    }

    fmt.Printf("Got a total of %d results\n", len(result))

    for _, r := range result {
       fmt.Printf("Result: %+v\n", r)
    }
}
Copy code
2025/12/04 10:50:58 
GET /admin/identities HTTP/1.1
Host: playground.projects.oryapis.com
User-Agent: OpenAPI-Generator/1.0.0/go
Accept: application/json
Authorization: Bearer redacted
Accept-Encoding: gzip


2025/12/04 10:50:58 
HTTP/2.0 403 Forbidden
s
You need to set the URL still, the default is using the public playground project which your API key is not valid for.
Copy code
// Configure Ory SDK
cfg := ory.NewConfiguration()
cfg.Servers = ory.ServerConfigurations{{URL: baseUrl}}
c
Ok thanks, that was hard to find