Swift iOS project template that handles authentication with email/password, Sign in with Google, and Sign in with Apple. It contains iOS 16 SwiftUI features such as the new Navigation system, and the code is architected in a way that is scalable if you want to build onto this boilerplate. This template also includes a basic form of persisted sign-in.
If you cloned the repo, add your own Bundle ID in the project configuration.
If you cloned the repo, the following dependencies should already be in added to your project via Swift Package Manager (SPM). If you want to use CocoaPods, add the below dependencies to your PodFile.
Create a new project in Firebase, and then add a new Apple App (for further instruction see Firebase Setup for iOS). You will need the auto-generated GoogleService-Info.plist file to run this project.
Add Email/Password, Sign in with Google, and Sign in with Apple Sign-In Methods on your Firebase project once setup (under Authentication > Sign-In Methods tab)
Sign in with Google
Add a new GIDClientID property under Targets > Info > Custom macOS Application Target Properties in XCode
Hover over the list of existing properties, right click, Add Row. Let the key = “GIDClientID”, tab over to the value cell, and paste in the CLIENT_ID from your GoogleService-Info.plist configuration file.
Add custom URL scheme to your Xcode project:
Open your project configuration: click the project name in the left tree view. Select your app from the TARGETS section, then select the Info tab, and expand the URL Types section.
Click the + button, and add a URL scheme for your reversed client ID. To find this value, open the GoogleService-Info.plist configuration file, and look for the REVERSED_CLIENT_ID key. Copy the value of that key, and paste it into the URL Schemes box on the configuration page. Leave the other fields blank.
Ensure that Sign in with Apple is already added to your project’s capabilities. If not, you will need to add it.
NOTE: I added the Keychain Sharing capability because it gets rid of some console warnings and fixes a bug when signing in with Email/Password, but functionality for using the Apple Keychain is not included in this template.
If you want to configure your Firebase App further, go to Google Cloud Console and you should find the project you just created in Firebase. This can be helpful for creating API restrictions if you so desire.
Firebase Authentication Boilerplate App for iOS
Swift iOS project template that handles authentication with email/password, Sign in with Google, and Sign in with Apple. It contains iOS 16 SwiftUI features such as the new Navigation system, and the code is architected in a way that is scalable if you want to build onto this boilerplate. This template also includes a basic form of persisted sign-in.
Setup
Sign in with Google
Sign in with Apple
References
Special thanks goes out to Joseph Hinkle and his repo https://github.com/joehinkle11/Login-with-Apple-Firebase-SwiftUI which was my main reference for this project.
If you want to configure your Firebase App further, go to Google Cloud Console and you should find the project you just created in Firebase. This can be helpful for creating API restrictions if you so desire.