# How to link app data to auth0 users?

**URL:** <https://community.auth0.com/t/how-to-link-app-data-to-auth0-users/8301>\
**Category:** Get Help\
**Tags:** lucene, v2, cluster, management-api, support\
**Created:** [September 26, 2017, 2:08pm UTC](https://community.auth0.com/t/how-to-link-app-data-to-auth0-users/8301 "2017-09-26T14:08:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bebbi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bebbi/32/10625_2.png) [@bebbi](https://community.auth0.com/u/bebbi)\
**Post date:** [September 26, 2017, 2:08pm UTC](https://community.auth0.com/t/how-to-link-app-data-to-auth0-users/8301/1 "2017-09-26T14:08:03Z")

</div>

There’s some uncertainty in our company on whether the way we can link app data (foreign keys) to auth0 users has changed very recently.

Our example is the need to store a list of ids for sold products with each seller.  
Then we need to query all sellers that have a specific product ID.

**Nov 2016 recommendation by auth0 team** :

> You could store an array of  
> productID’s in app\_metadata (or  
> user\_metadata, [please read this doc](https://auth0.com/forum/t/user-metadata-vs-app-metadata/1420/3) (inactive link) to  
> see which would suit). e.g.

```
//app_metadata
"products": 
  "productX", 
  "productB"
]

```

> You could then query using API v2 users search with the following query:

```
app_metadata.products:"productB"

```

> This would return all users with `productB` in their `app_metadata.products`.

**Aug 2017, our working query based on this is:**

```
_exists_:user_metadata.products.product1

```

**Sep 2017 support answer after query stopped working in some tenants**

In our multi-stage env, this query stops working in some, not all environments.  
The answer to our question about it is:

> the query you are trying to do ( `_exists_:user_metadata.products.product1`) is not supported. This [document](https://auth0.com/docs/api/management/v2/user-search) explains what fields can be used in searching.

**Status**

I’m copying this here for others that may suffer this problem.  
I have a question on valid alternatives outstanding with support and will update here when there are news.

cc: @nico.sabena1 @prashant

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:56am UTC](https://community.auth0.com/t/how-to-link-app-data-to-auth0-users/8301/2 "2018-03-02T05:56:41Z")

</div>


