GoSDK Management API returns 401 Unauthorized: Bad audience: http://localhost:8080/

Hi Everyone,
I was trying to find answer in previous questions, but it looks like there is no one recipe, so asking here:-)

So what I need: I am trying to create a user using go-sdk.

What I’m doing:

  1. Setting up the Management Client
m, err := management.New(domain, management.WithClientCredentialsAndAudience(ctx, clientID, clientSecret, audience)) // Here audience is http://localhost:8080/
  1. Using the management client to create a user
managementClient.Client.User.Create(ctx, &user)

What I received:

"error":"401 Unauthorized: Bad audience: http://localhost:8080/",

I encountered a few topics in the past, but they didn’t help. Can someone please help me with what I am doing wrong here?

Hey there @iamkaustav welcome to the community!

Sorry for the delayed response here, but wanted to respond to this one anyway for future reference.

For all Management API SDK libraries, the audience param must be that of your Management API endpoint - Please see this documentation for more details on requesting Management API access tokens.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.