Firebase
Getting Started
Setting up Firebase in your SwiftStruct project.
Create a Firebase project
- Go to the Firebase Console
- Sign in with your Google account
- Click "Add project" or "Create a project"
- Enter your project name
- Choose whether to enable Google Analytics (optional)
- Click "Create project" and wait for it to finish
Set up Firebase products
Authentication
- In the Firebase Console, go to Authentication in the left sidebar
- Click "Get started"
- Enable the sign-in methods you want to use:
- Email/Password: Enable and save
- Sign in with Apple: Enable and configure
- Google: Enable and configure
- GitHub: Enable and configure. To create a GitHub OAuth app:
- Go to GitHub Settings → Developer settings → OAuth Apps
- Click "New OAuth App"
- Enter an application name
- Set the Authorization callback URL to:
https://YOUR_PROJECT_ID.firebaseapp.com/__/auth/handler - Click "Register application"
- Copy the Client ID and Client secret
- Paste them into Firebase Authentication settings
- Phone: Enable and configure
Firestore Database
- Go to Firestore Database in the left sidebar
- Click "Create database"
- Choose to start in production mode or test mode (the project comes with sensible defaults)
- Select a location for your database (choose the closest to your users)
- Click "Enable"
Storage
- Go to Storage in the left sidebar
- Click "Get started"
- Review the security rules (the project comes with sensible defaults)
- Choose a storage location
- Click "Done"
Hosting
- Go to Hosting in the left sidebar
- Click "Get started" (required for email link sign up)
Add an iOS app
- In your Firebase project, click the iOS icon to add an iOS app
- Enter your iOS bundle ID (use what you used during setup, found in your Xcode project settings)
- Register the app
- Download the
GoogleService-Info.plistfile - Add the
GoogleService-Info.plistfile toResources/GoogleService-Info.plistin your Xcode project
Deploy Firebase configuration
- Navigate to
apps/firebasein your project - Run
firebase loginif you haven't already authenticated - Run
firebase initand override the default config when prompted - Run
firebase deployto deploy all rules and configuration - Accept all prompts during the deployment process