iOS Swift Getting Started

This quickstart guide contains individual steps which demonstrate how to use various Auth0 features in your iOS applications. Each step has a dedicated sample project which can be downloaded directly from the quickstart guide or forked on Github.

About the Sample Applications

The code snippets within this quickstart guide are based on the downloadable samples. Within each of these samples, you will find a very simple application which utilizes a few ViewControllers.

It should be noted that a simplistic application is used in the samples and snippets intentionally. The focus of this quickstart guide is on how to use Auth0 in an application in general rather than on how to approach various architectural scenarios.

Auth0 Dependencies

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.


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

github "auth0/Lock.iOS-OSX" ~> 2.1
github "auth0/Auth0.swift" ~> 1.3

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', '~> 2.1'
pod 'Auth0', '~> 1.3'

Then, run pod install.

For further reference on Cocoapods, check their official documentation.

Adding Auth0 Credentials

The dependencies listed above require your client credentials in order for them to work. If you downloaded 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.

Add your credentials in Auth0.plist. You have to create that file if it doesn't already exist in your project:

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

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.

In your application's Info.plist file, register your iOS Bundle Identifer as a custom scheme:


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


Next Tutorial
2. Login
Use Auth0 for FREECreate free Account