# Rules not working with iOS SDK

**URL:** <https://community.auth0.com/t/rules-not-working-with-ios-sdk/7571>\
**Category:** Get Help\
**Tags:** rules, ios\
**Created:** [July 19, 2017, 12:13am UTC](https://community.auth0.com/t/rules-not-working-with-ios-sdk/7571 "2017-07-19T00:13:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@harry1](https://community.auth0.com/u/harry1)\
**Post date:** [July 19, 2017, 12:13am UTC](https://community.auth0.com/t/rules-not-working-with-ios-sdk/7571/1 "2017-07-19T00:13:09Z")

</div>

I have written a rule to add a user to my database upon their first login (check is a db query which I have tested several times), but the rule only fires if I am using the test rule, not when a user signs up or logs in with the iOS SDK (social and un-pw connections).

Any suggestions on how to get this working or explanations for why this doesn’t work would be greatly appreciated.

---

<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:** [July 19, 2017, 2:08pm UTC](https://community.auth0.com/t/rules-not-working-with-ios-sdk/7571/2 "2017-07-19T14:08:42Z")

</div>

The rules are run as part of the server-side pipeline provided by the Auth0 service so it’s unlikely that the issue is related to any client-side SDK or even to anything related to the client application. In addition, the rules that you configure through the Dashboard will run as part of the authentication transaction after the end-user provides an initial set of valid credentials so if you’re performing a login/authentication transaction it’s likely that rules are being run.

However, depending on your rule logic they may not be having the desired effect and end-up giving the illusion of not running.

The easiest approach to troubleshoot your rules as part of a real authentication transaction is to perform the following steps:

1. Install the Real-time Webtask Logs extension.
2. Include `console.log`statements in every logical branch of your rule code.
3. Open the extension.
4. Perform a user authentication through your client application.
5. Analyze the output of the `console.log` statements to review the execution flow of the rule.

---

<div class="post-metadata">

**Author:** ![harry1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@harry1](https://community.auth0.com/u/harry1)\
**Post date:** [July 19, 2017, 9:58pm UTC](https://community.auth0.com/t/rules-not-working-with-ios-sdk/7571/3 "2017-07-19T21:58:54Z")

</div>

Edit: just used the logs and saw the issue was with mongoose… Thanks so much!

---

<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:55am UTC](https://community.auth0.com/t/rules-not-working-with-ios-sdk/7571/4 "2018-03-02T05:55:28Z")

</div>


