Auth0 and multiple environments for iOS apps

One thing that's a little odd about Auth0 is that you need to setup an Auth0.plist file to configure the service. This becomes a problem when you want to separate development from production environments where keys are different.

One trick to solve this requires setting up a “Run Phase” that can copy the final .plist at build time. Here's how you do it:

Go to settings

Click on the little + symbol and add the following “Run Script”:




if [ "$CONFIGURATION" == "Debug" ]; then

It should look like this:

Run Phase

Create the different files for development and production

Create a folder called “Authentication” to match the script above and add your new configuration files there. One for Auth0-development.plist and another for Auth0-production.plist.

They should like something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Done!, once you run your app in either development or production the right config file will be used.