Everything works up to now. This is how I’m trying to get the user metadata with the management API.
user, err := auth0Api.User.Read(
ctx,
id, // The id returned from profile["sub"]
management.IncludeFields("user_metadata", "app_metadata"),
)
This request fails to send. It appears to be sending a get request to https://auth0domain/api/v2/users/userId and a post request to https://auth0domain/oauth/token in the stack trace.
The requests that your applications sends seem to be correct ones. Make sure that you have authorized the client with the necessary scopes and that the clientID and secret are the right ones.
I can see that the Go-Auth0 SDK for the Management API does offer some numerous examples inside it for the different Management API calls.
Inside the Management folder, there us a user_test.go file which you can explore for different test functions using the Management API. I have found this function which retrieves the user’s information: