iOS-Swift Introduction

This multi-step quickstart guide will walk you through managing authentication in your iOS apps with Auth0.

Sample Projects

System Requirements

These tutorials and seed projects have been tested with the following:

  • CocoaPods 1.0.0
  • XCode 7.3 (7D175)
  • iPhone 6 - iOS 9.3 (13E230)

Each tutorial in the series includes a link to its corresponding sample project, which demonstrates how to achieve the tutorial's goal. You can find all the samples here.


Each tutorial will require you to use either Lock or the Auth0.swift toolkit, or both.

A brief description:

  • Lock is a widget that is easy to present in your app. It contains default templates (that can be customized) for login with email/password, signup, social providers integration, and password recovery.
  • Auth0.swift is a toolkit that lets you communicate efficiently with many of the basic Auth0 API functions.

These dependencies are already integrated into each sample project through Cocoapods. We have chosen to use an approach of not git-ignoring them in the samples repo; that way, you don't have to worry about running pod commands— once you've cloned the repo, the samples are ready to be run!

It's recommended that, as a starting point for your project, you download the seed project described above, which already includes these dependencies.

Otherwise, if you're starting an empty project on your own, or if you want to add authentication to an existing project of yours, you have to make sure you install them:


If you are using Carthage, add the following lines to your Cartfile:

github "auth0/Lock.iOS-OSX" -> 1.26
github "auth0/Auth0.swift" "1.0.0-beta.5"

Then, run carthage bootstrap.

For more information about Carthage usage, check their official documentation.


If you are using Cocoapods, add these lines to your Podfile:

pod 'Lock', '~> 1.26'
pod 'Auth0', '1.0.0-beta.5'

Then, run pod install.

For further reference on Cocoapods, check their official documentation.

Create an Application

Create an Auth0 account (or login) and add an authentication client instance from the dashboard. Once you create your client, you will be provided with credentials (Domain, Client ID, and Client Secret) which should be stored somewhere safe (do not commit this information to your git repo!). You can download the sample after you login and it will be pre-configured with your Default App credentials.

App Dashboard

Configure Callback URLs

Callback URLs are the URLs that Auth0 invokes after the authentication process. Auth0 routes your application back to this URL and appends additional parameters to it, including a token. Since callback URLs can be manipulated, you will need to add your application's URL to your client's Allowed Callback URLs for security. This will enable Auth0 to recognize these URLs as valid. If omitted, authentication will not be successful.

That being said, go to your Client's Dashboard and make sure that Allowed Callback URLs contains the following:


Set Credentials

The dependencies listed above requires that you set your credentials in two different .plist files in order for them to work. If you downloaded the seed project, or any sample project from here, these credentials are automatically set. Either way, you have to make sure they are there—otherwise your app might crash.

Make sure you have the following entries in your project's Info.plist:


Also, make sure you have the following entries in a file named Auth0.plist. You have to create that file if it doesn't already exist:


Next Tutorial
2. Login
Try Auth0 for FREECreate free Account