This repository contains completed version of the project featured in the Auth0 Blog Calling a protected API from an iOS Swift App. The article walks you through the process of calling a protected API once integrated with Auth0 authentication in an iOS app based on the SwiftUI framework.
- As an iOS project, it needs to be built on a computer running macOS, preferably macOS 11.6, a.k.a. “Big Sur” or later.
- The project is built using Apple’s official IDE, Xcode (preferably version 12 or later), which is available for download via the macOS App Store or from the Apple Developer site.
- You’ll need an iOS device, either real or virtual:
- If you want to deploy the app to a real iOS device, you’ll need a free Apple Developer account, which requires an Apple ID with two-factor authentication enabled.
- If you want to deploy the app to a virtual iOS device, you just need Xcode, which includes the Simulator (which simulates current iOS devices and operating systems), as well as a facility for downloading simulators for older iOS devices and operating systems.
-
If you don’t already have an Auth0 account, sign up for a free one.
-
Clone the repo:
git clone https://github.com/auth0-blog/auth0-swift-protected-api-call.git
-
Install the Auth0.swift package using Xcode:
- In Xcode, select File → Add Packages.... The Add Packages window will appear.
- In Add Packages window, enter this URL into the search field:
https://github.com/auth0/Auth0.swift.git
. - Select the Auth0.swift package that appears in the list of packages and in the Dependency Rule menu, select Up to Next Major Version.
- Click Add Package.
-
Log into the Auth0 dashboard and then follow the steps in the Auth0 Blog article for more details.
- Auth0’s iOS/macOS Quickstart page: Provides you with a “starter” project with basic authentication built in.
The code in this repository is licensed under the Apache 2.0 License.