Add Passage
Add Passage to your iOS project
Prerequisites
A recent version of Xcode
App running iOS 14 or later (although passkeys only work on iOS16+)
A Passage account (register for free if you haven’t already)
A Passage app (if you don't have one, learn how to create one here)
If you don't already have an iOS project and just want to try out Passage, you can clone our iOS Example App.
Add Passage SDK to your iOS app
Installation
You can easily install Passage through Swift Package Manager or Cocoapods.
To install via Swift Package Manager, simply enter this url Xcode's Swift Package Manager's search bar:
If your app uses Cocoapods instead, add this dependency to your Podfile
:
Usage
Import Passage and delcare an instance, like this:
If you are NOT using passkeys, that's it - you're ready to start using Passage!
If you ARE using passkeys, follow the below instructions
Configure app for passkeys
Step 1: Add your iOS app in Passage Console
In the Passage Console, navigate to "Native Apps" and add your iOS app. You'll need your app's bundle identifier and Apple Developer Team ID.
Step 2: Publish Associated Domains file
Apple uses Associated Domains to establish a secure association between your domain and your app so you can securely authenticate your users with passkeys. You'll need to create and serve the associated domains file in order to use passkeys or magic links in your iOS app.
Get associated domains file
Click the menu button on your Native App in Passage Console to download your apple-app-site-association
file.
Publish associated domains file
Serve this file from your site’s .well-known/
directory. Note that your Passage app's authentication origin must match the domain where this file is hosted.
Step 3: Add Associated Domains entitlements to your app
The next step is to enable the appropriate entitlements for your project in Xcode. These entitlements will associate your iOS app with your domain and use the apple-app-site-association file to verify this association.
To add the capability and entitlements to your application:
Open the target's "Signing & Capabilities" tab in Xcode and add Associate Domains capability.
Click Add(+) at the bottom of the Associate Domains section.
Add
webcredentials:YOUR_DOMAIN
like in the screenshot below. Addapplinks:YOUR_DOMAIN
if your app uses magic links.
Last updated