Auth0 Home Blog Docs

Rules not working with iOS SDK

rules
ios

#1

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.


#2

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.logstatements 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.

#3

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


#4