Skip to content

Commit d5ba0ce

Browse files
committed
Add Apple Sign in docs
1 parent 890dd0c commit d5ba0ce

File tree

2 files changed

+183
-2
lines changed

2 files changed

+183
-2
lines changed

docs/integrations/firebase.md

Lines changed: 183 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,189 @@ Once the authentication code is added, you’ll need to configure your project f
320320

321321
If you’re building for the web and want to test authentication while running your app in Dreamflow, follow the steps in the [Add Authorized Domain](#add-authorized-domain) section to add your Dreamflow preview domain to the **Authorized Domains** list in the Firebase Console.
322322

323+
324+
325+
### Apple Authentication
326+
327+
To configure Apple Sign-In for your app, follow these steps:
328+
329+
#### 1. Firebase Console Setup
330+
331+
Open **Firebase Console** > **Authentication** > **Sign-in method**. Enable **Apple** as a sign-in provider. Keep this page open, you’ll return here after configuring Apple in the Developer portal.
332+
333+
#### 2 Apple Developer Setup
334+
335+
Go to the **Apple Developer** portal > [Identifiers list](https://developer.apple.com/account/resources/identifiers/list) and follow the steps below:
336+
337+
##### 2.1 Create an App ID (for iOS app)
338+
339+
Follow Apple’s official instructions to [create an App ID](https://developer.apple.com/help/account/identifiers/register-an-app-id/). During the setup process, make sure you enable the **Sign In with Apple** capability, then finish by selecting **Continue** and **Register** to create the App ID.
340+
341+
<div style={{
342+
position: 'relative',
343+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
344+
height: 0,
345+
width: '100%'}}>
346+
<iframe
347+
src="https://demo.arcade.software/ghjEj6tOvVJYPO2wykDX?embed&show_copy_link=true"
348+
title=""
349+
style={{
350+
position: 'absolute',
351+
top: 0,
352+
left: 0,
353+
width: '100%',
354+
height: '100%',
355+
colorScheme: 'light'
356+
}}
357+
frameborder="0"
358+
loading="lazy"
359+
webkitAllowFullScreen
360+
mozAllowFullScreen
361+
allowFullScreen
362+
allow="clipboard-write">
363+
</iframe>
364+
</div>
365+
<p></p>
366+
367+
##### 2.2 Create Service ID (Required for Web & Android)
368+
369+
1. Click **+** to add new identifier.
370+
2. Select **Services IDs > Continue**.
371+
3. Enter the **Identifier** and **Description**. For Identifier, you can set it by appending **“.signin”** to your bundle ID (e.g., `com.awesomeorg.uplift.signin`), or use any unique identifier.
372+
4. Check **Sign In with Apple** and then click **Configure**.
373+
5. Select your App ID as the **Primary App ID**.
374+
6. Under **Website URLs**:
375+
- **Domains**: Add your Firebase domain (e.g., `yourproject.firebaseapp.com`). Do NOT include "https://" - just the domain.
376+
- **Return URLs**: Add `https://yourproject.firebaseapp.com/__/auth/handler`
377+
(Replace "yourproject" with your actual Firebase project ID).
378+
7. Click **Next** > **Done** > **Continue** > **Register**.
379+
380+
<div style={{
381+
position: 'relative',
382+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
383+
height: 0,
384+
width: '100%'}}>
385+
<iframe
386+
src="https://demo.arcade.software/SmSQJnSumnscPt9uOd6Q?embed&show_copy_link=true"
387+
title=""
388+
style={{
389+
position: 'absolute',
390+
top: 0,
391+
left: 0,
392+
width: '100%',
393+
height: '100%',
394+
colorScheme: 'light'
395+
}}
396+
frameborder="0"
397+
loading="lazy"
398+
webkitAllowFullScreen
399+
mozAllowFullScreen
400+
allowFullScreen
401+
allow="clipboard-write">
402+
</iframe>
403+
</div>
404+
<p></p>
405+
406+
##### 2.3 Create a Key (required for Firebase)
407+
408+
1. Go to [Keys section](https://developer.apple.com/account/resources/authkeys/list).
409+
2. Click **+** to add new key.
410+
3. Enter the **Key Name**, e.g., "Apple Sign In Key for Firebase".
411+
4. Check **Sign In with Apple.**
412+
5. Click **Configure** and select your App ID.
413+
6. Click **Save > Continue > Register.**
414+
7. Click **Download** to get the `.p8` key file. Save this file securely - you can only download it once!
415+
8. Note down the Key ID (shown on the page, e.g., ABC123XYZ) you’ll need this in Firebase Setup.
416+
417+
<div style={{
418+
position: 'relative',
419+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
420+
height: 0,
421+
width: '100%'}}>
422+
<iframe
423+
src="https://demo.arcade.software/AbKA1APHoqkIJ07apBqj?embed&show_copy_link=true"
424+
title=""
425+
style={{
426+
position: 'absolute',
427+
top: 0,
428+
left: 0,
429+
width: '100%',
430+
height: '100%',
431+
colorScheme: 'light'
432+
}}
433+
frameborder="0"
434+
loading="lazy"
435+
webkitAllowFullScreen
436+
mozAllowFullScreen
437+
allowFullScreen
438+
allow="clipboard-write">
439+
</iframe>
440+
</div>
441+
<p></p>
442+
443+
##### 2.4 Connect Apple to Firebase
444+
445+
1. Go back to **Firebase Console** > **Authentication** > **Sign-in method** > **Apple**.
446+
2. Under **OAuth code flow configuration**, fill in the following:
447+
- **Service ID**: The Service ID you created in Step 2.2 (e.g., `com.awesomeorg.uplift.signin`).
448+
- **Apple Team ID**: Found in your [Apple Developer account](https://developer.apple.com/account) under **Membership Details**.
449+
- **Key ID**: The Key ID from Step 2.3.
450+
- **Private key**: Paste the content of `.p8` file downloaded in Step 2.3.
451+
3. Click **Save** to complete the configuration.
452+
453+
![connect-apple-to-firebase.avif](imgs/connect-apple-to-firebase.avif)
454+
455+
#### 3. Add Apple Authentication Code
456+
457+
You can add the Apple sign-in code manually or let the Dreamflow Agent generate it for you. Here’s the **sample agent prompt** you can try:
458+
459+
```jsx
460+
Generate Apple Sign-In authentication code for both mobile and web using the latest versions of firebase_auth package.
461+
```
462+
463+
#### 4. iOS Setup
464+
465+
1. Download your project and open ios/Runner.xcworkspace in Xcode
466+
2. Select the **Runner** project in the navigator
467+
3. Select the **Runner** target
468+
4. Go to **Signing & Capabilities** tab
469+
5. Click **+ Capability** and add **Sign In with Apple**
470+
6. Make sure your **Bundle Identifier** matches exactly what you set in the Dreamflow.
471+
7. Select your development team
472+
8. Run the app to test Apple sign in.
473+
474+
<div style={{
475+
position: 'relative',
476+
paddingBottom: 'calc(52.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
477+
height: 0,
478+
width: '100%'}}>
479+
<iframe
480+
src="https://demo.arcade.software/S27VBj3c61edsUuK45Of?embed&show_copy_link=true"
481+
title=""
482+
style={{
483+
position: 'absolute',
484+
top: 0,
485+
left: 0,
486+
width: '100%',
487+
height: '100%',
488+
colorScheme: 'light'
489+
}}
490+
frameborder="0"
491+
loading="lazy"
492+
webkitAllowFullScreen
493+
mozAllowFullScreen
494+
allowFullScreen
495+
allow="clipboard-write">
496+
</iframe>
497+
</div>
498+
<p></p>
499+
500+
:::info
501+
- **For Android** and **Web**: Make sure you have completed the [**OAuth code flow configuration**](#24-connect-apple-to-firebase) in the Firebase console.
502+
- **User Info Only on First Sign-In**: Apple only returns the user’s **name** and **email** on the **first** successful sign-in. You should **store this data** (e.g., in Firestore or your backend) the first time you receive it. On subsequent sign-ins, these fields will be `null` / omitted.
503+
- **“Hide My Email” (Private Relay)**: Some users choose **“Hide My Email”** when signing in. Apple then provides a **proxy email**, e.g., `abc123@privaterelay.appleid.com`. To send emails through the proxy email to the users’ personal inboxes, you'll need to [**configure private email relay service**](https://developer.apple.com/help/account/capabilities/configure-private-email-relay-service/).
504+
:::
505+
323506
### Add Authorized Domain
324507

325508
If you’re building for the web and want to test authentication while running your app in Dreamflow, you must add your Dreamflow preview domain to the **Authorized Domains** list in the Firebase Console.
@@ -335,8 +518,6 @@ Locate the log entry that contains a URL like: `wss://summer-firefly-vuh34ynj.mu
335518

336519
![add-authorized-domain](imgs/add-authorized-domain.avif)
337520

338-
339-
340521
## Add Sample Data to Firebase
341522

342523
Dreamflow lets you add sample data to your Firebase project for easier development and testing. The generated data follows your app’s schema, so you can quickly check how your app works with populated users, collections, and documents.
96 KB
Binary file not shown.

0 commit comments

Comments
 (0)