# Using auth0 management SDK

**URL:** <https://community.auth0.com/t/using-auth0-management-sdk/63003>\
**Category:** Get Help\
**Tags:** access-token, auth0\
**Created:** [May 18, 2021, 1:20pm UTC](https://community.auth0.com/t/using-auth0-management-sdk/63003 "2021-05-18T13:20:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![monika.prakash](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/monika.prakash/32/13482_2.png) [@monika.prakash](https://community.auth0.com/u/monika.prakash)\
**Post date:** [May 18, 2021, 1:20pm UTC](https://community.auth0.com/t/using-auth0-management-sdk/63003/1 "2021-05-18T13:20:28Z")

</div>

Hi  
I am using gopkg.in/auth0.v5/management  
In my go-lang api I need to use management api.

because I need to check the user details

I am trying to use the sdk for this api , here I need the token

domain + “/api/v2/users-by-email?email=” + ctxUser.Email

i tried the following code

```
   txUser := impart.GetCtxUser(ctx)
  
   m, err := management.New(domain, management.WithClientCredentials(clientid, clientsecret))
	res2B, _ := json.Marshal(m)
	if err != nil {
		// handle err
	}

         existingUsers, err := m.User.ListByEmail(ctxUser.Email)
	if err != nil {
		// handle err
	}

         if len(existingUsers) == 0 {
		return
	}

```

here I am getting len(existingUsers )=0 but user is exist in auth0 server

I need to get the corresponding user details

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [May 18, 2021, 3:09pm UTC](https://community.auth0.com/t/using-auth0-management-sdk/63003/2 "2021-05-18T15:09:58Z")

</div>

Unsure if it’s what explains the outcome you’re experiencing, but one thing to have in mind is that the endpoint in question looks for an exact match to the provided email address and **is case-sensitive**. Is it possible that the email you’re searching for and the one in the service differs by the case?

---

<div class="post-metadata">

**Author:** ![monika.prakash](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/monika.prakash/32/13482_2.png) [@monika.prakash](https://community.auth0.com/u/monika.prakash)\
**Post date:** [May 18, 2021, 3:38pm UTC](https://community.auth0.com/t/using-auth0-management-sdk/63003/3 "2021-05-18T15:38:26Z")

</div>

Hi @jmangelo

Thank you for replaying.

emails are same.

while using this api call

domain + “/api/v2/users-by-email?email=” + ctxUser.Email

I am getting the correct details of the user.

I want to fetch the auth0 user details using golang code

so I find out we can use the management SDK. but using the SDK its not returning anything, even not creating the token

or

if I use api instead of using sdk. How can I get the token through code.

My requirement is that, I want to fetch the auth0user details of a specific email using golang.

this is what I am saying

> **[Retrieve Users with Get Users by Email Endpoint](https://auth0.com/docs/manage-users/user-search/retrieve-users-with-get-users-by-email-endpoint)**
>
> Learn how to retrieve lists of users using the get-users-by-email endpoint.

but I dint get how can I get ‘YOUR\_MGMT\_API\_ACCESS\_TOKEN’ in my goland code.

I tried to use SDK for this purpose, but I didn’t get the output management.New() function is returning nil

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [May 20, 2021, 2:55pm UTC](https://community.auth0.com/t/using-auth0-management-sdk/63003/4 "2021-05-20T14:55:15Z")

</div>

The access token should be obtained by the SDK when you initialize it with `management.WithClientCredentials(clientid, clientsecret)`. Have you confirmed that you’re passing the correct values for client ID and secret? In addition, have you authorized the client to be able to obtain a Management API access tokens with the necessary scopes?

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 25, 2021, 8:31am UTC](https://community.auth0.com/t/using-auth0-management-sdk/63003/7 "2021-05-25T08:31:40Z")

</div>

Thanks for helping on this one Joao!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 27, 2021, 10:37am UTC](https://community.auth0.com/t/using-auth0-management-sdk/63003/8 "2021-05-27T10:37:43Z")

</div>


