iOS Objective-C: Getting Started
This quickstart guide walks you through managing authentication with Auth0 in your iOS Objective-C apps.
Each tutorial in this guide includes a link to a sample project showing the features described in the article. You can find all the samples in the iOS Objective-C samples folder.
All sample projects use a hybrid project, combining Objective-C and Swift. For more information, read the Mix and Match guide from Apple.
Create an application
Create a new client application in your Auth0 dashboard. For Type, select Native.
Add Auth0 Credentials
Your application needs some details about your client to communicate with Auth0. You can get these details from the Settings section for your client in the Auth0 dashboard.
You need the following information:
- Client ID
Add your credentials in the
Auth0.plist file. If the file does not exist in your project yet, create it:
<!-- Auth0.plist --> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>ClientId</key> <string>YOUR_CLIENT_ID</string> <key>Domain</key> <string>YOUR_AUTH0_DOMAIN</string> </dict> </plist>
Configure Callback URLs
A callback URL is a URL in your application where Auth0 redirects the user after they have authenticated.
You need to whitelist the callback URL for your app in the Allowed Callback URLs field in your Client Settings. If you do not set any callback URL, your users will see a mismatch error when they log in.
In your application's
Info.plist file, register your iOS Bundle identifier as a custom scheme:
<!-- Info.plist --> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>None</string> <key>CFBundleURLName</key> <string>auth0</string> <key>CFBundleURLSchemes</key> <array> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> </array> </dict> </array>
Go to your Dashboard Settings and make sure that the Allowed Callback URLs field contains the following callback URL: