# Rule API changed without notice

**URL:** <https://community.auth0.com/t/rule-api-changed-without-notice/7120>\
**Category:** Get Help\
**Tags:** app\_metadata, rules, metadata, breaking-change\
**Created:** [June 17, 2017, 1:23am UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120 "2017-06-17T01:23:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![csv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/csv/32/7750_2.png) [@csv](https://community.auth0.com/u/csv)\
**Post date:** [June 17, 2017, 1:23am UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/1 "2017-06-17T01:23:41Z")

</div>

Today we encountered an issue in our dev environment. After some digging it turned out that all the custom claims on our `access_token` were gone. So I started debugging the rule that provided these claims. Turns out that `user.app_metadata` was now `undefined`, though a new field `user.metadata` had the same content as `user.app_metadata` did previously.

Was this an intentional breaking change or is this a bug? Our production environment still works with the exact same rule contents.

Any insight into this issue would be very welcome

* * *

**Update:**  
We are using `auth0-js - v8.7.0` ([GitHub - auth0/auth0.js: Auth0 headless browser sdk · GitHub](https://github.com/auth0/auth0.js))

- The auth requests affected use the following endpoint, with parameters something like this:
- [https://apptus-dev.eu.auth0.com/authorize](https://apptus-dev.eu.auth0.com/authorize)
- response\_type=“id\_token token”
- response\_mode=fragment
- prompt=none
- + scope, client\_id, redirect\_uri, state, nonce, audience
- Database connection only
- As far as I know, only I encountered it because no one else worked on this area before I made a fix to the rule. I can remove the fix and try with a few different users if necessary.
- This happened every time from when I started to notice it. Since I adjusted the rule, I do not know if this still is an issue.

* * *

**Update 2:**  
This just occurred now on our production environment: `apptus.eu.auth0.com`  
Same behavior as dev environment. Seems to affect all users the same.

---

<div class="post-metadata">

**Author:** ![BananaPower](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bananapower/32/2705_2.png) [@BananaPower](https://community.auth0.com/u/BananaPower)\
**Post date:** [June 20, 2017, 6:26am UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/2 "2017-06-20T06:26:05Z")

</div>

Hey man, I saw the same issue started to happen: [Expected rule behaviour change `user.app_metadata` becoming `user.metadata` sometimes - Auth0 Community](http://community.auth0.com/questions/4707/expected-rule-behaviour-change-userapp-metadata-be)

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [June 20, 2017, 11:01am UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/3 "2017-06-20T11:01:21Z")

</div>

@csv @martin.ma Can you both please provide the following for me to investigate:

- What API calls were made to authenticate?
- What connection were the users part of (database connection, Facebook, Google, etc)
- Does this happen for all user or only a select few?
- Does this happen all the time or only occasionally?

---

<div class="post-metadata">

**Author:** ![csv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/csv/32/7750_2.png) [@csv](https://community.auth0.com/u/csv)\
**Post date:** [June 20, 2017, 8:30pm UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/4 "2017-06-20T20:30:26Z")

</div>

@prashant I updated the question with the details I have. Let me know if you need further information for now.

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [June 21, 2017, 4:40am UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/5 "2017-06-21T04:40:16Z")

</div>

Thanks for notifying us of this issue - the engineering team is already working on a fix. In the meantime, please use the following at the beginning of your Rule to accommodate for both `user.app_metadata` and `user.metadata`:

```
var app_metadata = user.app_metadata || user.metadata;

//use `app_metadata` in Rule

```

---

<div class="post-metadata">

**Author:** ![BananaPower](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bananapower/32/2705_2.png) [@BananaPower](https://community.auth0.com/u/BananaPower)\
**Post date:** [June 21, 2017, 6:10am UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/6 "2017-06-21T06:10:34Z")

</div>

Hi @prashant, for my case the details are as follows:

- API Call: renewAuth (a.k.a. silent authentication, made through auth0.js - 8.4.0)
- Connections: the issue happened for at least both ‘google-oauth2’ and ‘facebook’
- Happened for all users. Could still be reproduced after removing the user and signing up again with the same user’s social identity.
- Usually after the 2nd or 3rd silent-auth call.

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [June 21, 2017, 6:13am UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/7 "2017-06-21T06:13:17Z")

</div>

Thanks @csv and @martin.ma - we have reproduced this on our end, with our engineering team working on a fix. Please see my answer for the workaround in the meantime.

---

<div class="post-metadata">

**Author:** ![csv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/csv/32/7750_2.png) [@csv](https://community.auth0.com/u/csv)\
**Post date:** [June 21, 2017, 6:22pm UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/8 "2017-06-21T18:22:07Z")

</div>

Yeah, that’s similar to what I changed the rule to use.  
Glad to know that this was a bug and not an undocumented breaking change 🙂

---

<div class="post-metadata">

**Author:** ![BananaPower](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bananapower/32/2705_2.png) [@BananaPower](https://community.auth0.com/u/BananaPower)\
**Post date:** [July 18, 2017, 2:50pm UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/9 "2017-07-18T14:50:36Z")

</div>

Hi @prashant, is there an estimated date when the fix will be rolled out?

---

<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:54am UTC](https://community.auth0.com/t/rule-api-changed-without-notice/7120/10 "2018-03-02T05:54:44Z")

</div>


