Skip to content

Commit 8ead310

Browse files
authored
Remove FDL SDK usage from Auth QS (#1583)
1 parent 757ed83 commit 8ead310

File tree

6 files changed

+61
-79
lines changed

6 files changed

+61
-79
lines changed

.github/workflows/authentication.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525
jobs:
2626
cocoapods:
2727
name: cocoapods
28-
runs-on: macOS-12
28+
runs-on: macOS-14
2929
env:
3030
SPM: false
3131
LEGACY: false
@@ -35,9 +35,8 @@ jobs:
3535
steps:
3636
- name: Checkout
3737
uses: actions/checkout@master
38-
# Facebook SDK requires Xcode 14
39-
- name: Xcode 14.1
40-
run: sudo xcode-select -s /Applications/Xcode_14.1.app/Contents/Developer
38+
- name: Xcode 15.3
39+
run: sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer
4140

4241
- name: Setup
4342
run: |

authentication/AuthenticationExample/SceneDelegate.swift

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
import UIKit
16-
import FirebaseDynamicLinks
1716
import FirebaseAuth
1817

1918
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
@@ -58,21 +57,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
5857
// MARK: - Firebase 🔥
5958

6059
private func handleIncomingDynamicLink(_ incomingURL: URL) {
61-
DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { dynamicLink, error in
62-
guard error == nil else {
63-
return print("ⓧ Error in \(#function): \(error!.localizedDescription)")
64-
}
60+
let link = incomingURL.absoluteString
6561

66-
guard let link = dynamicLink?.url?.absoluteString else { return }
62+
if Auth.auth().isSignIn(withEmailLink: link) {
63+
// Save the link as it will be used in the next step to complete login
64+
UserDefaults.standard.set(link, forKey: "Link")
6765

68-
if Auth.auth().isSignIn(withEmailLink: link) {
69-
// Save the link as it will be used in the next step to complete login
70-
UserDefaults.standard.set(link, forKey: "Link")
71-
72-
// Post a notification to the PasswordlessViewController to resume authentication
73-
NotificationCenter.default
74-
.post(Notification(name: Notification.Name("PasswordlessEmailNotificationSuccess")))
75-
}
66+
// Post a notification to the PasswordlessViewController to resume authentication
67+
NotificationCenter.default
68+
.post(Notification(name: Notification.Name("PasswordlessEmailNotificationSuccess")))
7669
}
7770
}
7871

authentication/AuthenticationExample/ViewControllers/OtherAuthMethodControllers/PasswordlessViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class PasswordlessViewController: OtherAuthViewController {
3535

3636
private func sendSignInLink(to email: String) {
3737
let actionCodeSettings = ActionCodeSettings()
38-
let stringURL = "https://\(authorizedDomain).firebaseapp.com/login?email=\(email)"
38+
39+
// Update "demo" to match the path defined in the dynamic link.
40+
let stringURL = "https://\(authorizedDomain)/demo"
3941
actionCodeSettings.url = URL(string: stringURL)
4042
// The sign-in operation must be completed in the app.
4143
actionCodeSettings.handleCodeInApp = true
@@ -46,6 +48,7 @@ class PasswordlessViewController: OtherAuthViewController {
4648

4749
// Set `email` property as it will be used to complete sign in after opening email link
4850
self.email = email
51+
print("successfully sent email")
4952
}
5053
}
5154

authentication/Podfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ target 'AuthenticationExample' do
99
## Firebase 🔥 Pods
1010
pod 'FirebaseAnalytics'
1111
pod 'FirebaseAuth'
12-
13-
### For Email Link/Passwordless Auth
14-
pod 'FirebaseDynamicLinks'
1512

1613
## Pod for Sign in with Google
1714
pod 'GoogleSignIn'

authentication/Podfile.lock

Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,66 @@ PODS:
55
- AppAuth/Core (1.7.5)
66
- AppAuth/ExternalUserAgent (1.7.5):
77
- AppAuth/Core
8-
- FBAEMKit (17.0.0):
9-
- FBSDKCoreKit_Basics (= 17.0.0)
10-
- FBSDKCoreKit (17.0.0):
11-
- FBAEMKit (= 17.0.0)
12-
- FBSDKCoreKit_Basics (= 17.0.0)
13-
- FBSDKCoreKit_Basics (17.0.0)
14-
- FBSDKLoginKit (17.0.0):
15-
- FBSDKCoreKit (= 17.0.0)
16-
- FirebaseAnalytics (10.24.0):
17-
- FirebaseAnalytics/AdIdSupport (= 10.24.0)
8+
- FBAEMKit (17.0.1):
9+
- FBSDKCoreKit_Basics (= 17.0.1)
10+
- FBSDKCoreKit (17.0.1):
11+
- FBAEMKit (= 17.0.1)
12+
- FBSDKCoreKit_Basics (= 17.0.1)
13+
- FBSDKCoreKit_Basics (17.0.1)
14+
- FBSDKLoginKit (17.0.1):
15+
- FBSDKCoreKit (= 17.0.1)
16+
- FirebaseAnalytics (10.25.0):
17+
- FirebaseAnalytics/AdIdSupport (= 10.25.0)
1818
- FirebaseCore (~> 10.0)
1919
- FirebaseInstallations (~> 10.0)
2020
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
2121
- GoogleUtilities/MethodSwizzler (~> 7.11)
2222
- GoogleUtilities/Network (~> 7.11)
2323
- "GoogleUtilities/NSData+zlib (~> 7.11)"
2424
- nanopb (< 2.30911.0, >= 2.30908.0)
25-
- FirebaseAnalytics/AdIdSupport (10.24.0):
25+
- FirebaseAnalytics/AdIdSupport (10.25.0):
2626
- FirebaseCore (~> 10.0)
2727
- FirebaseInstallations (~> 10.0)
28-
- GoogleAppMeasurement (= 10.24.0)
28+
- GoogleAppMeasurement (= 10.25.0)
2929
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
3030
- GoogleUtilities/MethodSwizzler (~> 7.11)
3131
- GoogleUtilities/Network (~> 7.11)
3232
- "GoogleUtilities/NSData+zlib (~> 7.11)"
3333
- nanopb (< 2.30911.0, >= 2.30908.0)
34-
- FirebaseAppCheckInterop (10.24.0)
35-
- FirebaseAuth (10.24.0):
34+
- FirebaseAppCheckInterop (10.25.0)
35+
- FirebaseAuth (10.25.0):
3636
- FirebaseAppCheckInterop (~> 10.17)
3737
- FirebaseCore (~> 10.0)
3838
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
3939
- GoogleUtilities/Environment (~> 7.8)
4040
- GTMSessionFetcher/Core (< 4.0, >= 2.1)
4141
- RecaptchaInterop (~> 100.0)
42-
- FirebaseCore (10.24.0):
42+
- FirebaseCore (10.25.0):
4343
- FirebaseCoreInternal (~> 10.0)
4444
- GoogleUtilities/Environment (~> 7.12)
4545
- GoogleUtilities/Logger (~> 7.12)
46-
- FirebaseCoreInternal (10.24.0):
46+
- FirebaseCoreInternal (10.25.0):
4747
- "GoogleUtilities/NSData+zlib (~> 7.8)"
48-
- FirebaseDynamicLinks (10.24.0):
49-
- FirebaseCore (~> 10.0)
50-
- FirebaseInstallations (10.24.0):
48+
- FirebaseInstallations (10.25.0):
5149
- FirebaseCore (~> 10.0)
5250
- GoogleUtilities/Environment (~> 7.8)
5351
- GoogleUtilities/UserDefaults (~> 7.8)
5452
- PromisesObjC (~> 2.1)
55-
- GoogleAppMeasurement (10.24.0):
56-
- GoogleAppMeasurement/AdIdSupport (= 10.24.0)
53+
- GoogleAppMeasurement (10.25.0):
54+
- GoogleAppMeasurement/AdIdSupport (= 10.25.0)
5755
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
5856
- GoogleUtilities/MethodSwizzler (~> 7.11)
5957
- GoogleUtilities/Network (~> 7.11)
6058
- "GoogleUtilities/NSData+zlib (~> 7.11)"
6159
- nanopb (< 2.30911.0, >= 2.30908.0)
62-
- GoogleAppMeasurement/AdIdSupport (10.24.0):
63-
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.24.0)
60+
- GoogleAppMeasurement/AdIdSupport (10.25.0):
61+
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.25.0)
6462
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
6563
- GoogleUtilities/MethodSwizzler (~> 7.11)
6664
- GoogleUtilities/Network (~> 7.11)
6765
- "GoogleUtilities/NSData+zlib (~> 7.11)"
6866
- nanopb (< 2.30911.0, >= 2.30908.0)
69-
- GoogleAppMeasurement/WithoutAdIdSupport (10.24.0):
67+
- GoogleAppMeasurement/WithoutAdIdSupport (10.25.0):
7068
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
7169
- GoogleUtilities/MethodSwizzler (~> 7.11)
7270
- GoogleUtilities/Network (~> 7.11)
@@ -76,32 +74,32 @@ PODS:
7674
- AppAuth (< 2.0, >= 1.7.3)
7775
- GTMAppAuth (< 5.0, >= 4.1.1)
7876
- GTMSessionFetcher/Core (~> 3.3)
79-
- GoogleUtilities/AppDelegateSwizzler (7.13.0):
77+
- GoogleUtilities/AppDelegateSwizzler (7.13.2):
8078
- GoogleUtilities/Environment
8179
- GoogleUtilities/Logger
8280
- GoogleUtilities/Network
8381
- GoogleUtilities/Privacy
84-
- GoogleUtilities/Environment (7.13.0):
82+
- GoogleUtilities/Environment (7.13.2):
8583
- GoogleUtilities/Privacy
8684
- PromisesObjC (< 3.0, >= 1.2)
87-
- GoogleUtilities/Logger (7.13.0):
85+
- GoogleUtilities/Logger (7.13.2):
8886
- GoogleUtilities/Environment
8987
- GoogleUtilities/Privacy
90-
- GoogleUtilities/MethodSwizzler (7.13.0):
88+
- GoogleUtilities/MethodSwizzler (7.13.2):
9189
- GoogleUtilities/Logger
9290
- GoogleUtilities/Privacy
93-
- GoogleUtilities/Network (7.13.0):
91+
- GoogleUtilities/Network (7.13.2):
9492
- GoogleUtilities/Logger
9593
- "GoogleUtilities/NSData+zlib"
9694
- GoogleUtilities/Privacy
9795
- GoogleUtilities/Reachability
98-
- "GoogleUtilities/NSData+zlib (7.13.0)":
96+
- "GoogleUtilities/NSData+zlib (7.13.2)":
9997
- GoogleUtilities/Privacy
100-
- GoogleUtilities/Privacy (7.13.0)
101-
- GoogleUtilities/Reachability (7.13.0):
98+
- GoogleUtilities/Privacy (7.13.2)
99+
- GoogleUtilities/Reachability (7.13.2):
102100
- GoogleUtilities/Logger
103101
- GoogleUtilities/Privacy
104-
- GoogleUtilities/UserDefaults (7.13.0):
102+
- GoogleUtilities/UserDefaults (7.13.2):
105103
- GoogleUtilities/Logger
106104
- GoogleUtilities/Privacy
107105
- GTMAppAuth (4.1.1):
@@ -120,7 +118,6 @@ DEPENDENCIES:
120118
- FBSDKLoginKit
121119
- FirebaseAnalytics
122120
- FirebaseAuth
123-
- FirebaseDynamicLinks
124121
- GoogleSignIn
125122

126123
SPEC REPOS:
@@ -135,7 +132,6 @@ SPEC REPOS:
135132
- FirebaseAuth
136133
- FirebaseCore
137134
- FirebaseCoreInternal
138-
- FirebaseDynamicLinks
139135
- FirebaseInstallations
140136
- GoogleAppMeasurement
141137
- GoogleSignIn
@@ -148,26 +144,25 @@ SPEC REPOS:
148144

149145
SPEC CHECKSUMS:
150146
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
151-
FBAEMKit: 31a20c2d8744d8c57d3a5b7ae4e27b4fdd819193
152-
FBSDKCoreKit: dac911b656816f8d0b06e5fa4bac60e89505bb3b
153-
FBSDKCoreKit_Basics: 92b7b7458d57091370b0b6cc197578874c3b4b16
154-
FBSDKLoginKit: 5d5271ebfd1e39c6b071de8db5c4bd6255be3561
155-
FirebaseAnalytics: b5efc493eb0f40ec560b04a472e3e1a15d39ca13
156-
FirebaseAppCheckInterop: fecc08c89936c8acb1428d8088313aabedb348e4
157-
FirebaseAuth: 711d01cccefaf10035b3090a92956d0dd4f99088
158-
FirebaseCore: 11dc8a16dfb7c5e3c3f45ba0e191a33ac4f50894
159-
FirebaseCoreInternal: bcb5acffd4ea05e12a783ecf835f2210ce3dc6af
160-
FirebaseDynamicLinks: 96e59750f0c383258c35f5b20e3c18e14b57933a
161-
FirebaseInstallations: 8f581fca6478a50705d2bd2abd66d306e0f5736e
162-
GoogleAppMeasurement: f3abf08495ef2cba7829f15318c373b8d9226491
147+
FBAEMKit: 97eaf41451b49691447df831f7f425229ae64b66
148+
FBSDKCoreKit: e34084567d11cfdd4787ace2b1a0255bedf34ade
149+
FBSDKCoreKit_Basics: 3d78e5fe00504e5c1aed1c48de0654c3a1565d15
150+
FBSDKLoginKit: 9a581053879a1e6fc3fab8ead341c78c6a318255
151+
FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248
152+
FirebaseAppCheckInterop: 5da5ce93e8797a215e3f677fb0654b74e736c8b8
153+
FirebaseAuth: c0f93dcc570c9da2bffb576969d793e95c344fbb
154+
FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483
155+
FirebaseCoreInternal: 910a81992c33715fec9263ca7381d59ab3a750b7
156+
FirebaseInstallations: 91950fe859846fff0fbd296180909dd273103b09
157+
GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356
163158
GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db
164-
GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152
159+
GoogleUtilities: c56430aef51a1aa57b25da78c3f8397e522c67b7
165160
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
166161
GTMSessionFetcher: 8000756fc1c19d2e5697b90311f7832d2e33f6cd
167162
nanopb: 438bc412db1928dac798aa6fd75726007be04262
168163
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
169164
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
170165

171-
PODFILE CHECKSUM: 10d6cbbf1f0fad7683646923bb534d939adf5a3a
166+
PODFILE CHECKSUM: 3fec667dd6bd8b6be4c37a6eac284e979d933bcd
172167

173168
COCOAPODS: 1.15.2

authentication/README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ See the [Getting Started with Password-based Sign In guide](https://firebase.goo
188188

189189
Email Link authentication, which is also referred to as Passwordless authentication, works by sending a verification email to a user requesting to sign in. This verification email contains a special **Dynamic Link** that links the user back to your app, completing authentication in the process. In order to configure this method of authentication, we will use [Firebase Dynamic Links](https://firebase.google.com/docs/dynamic-links), which we will need to set up.
190190

191-
If this is your first time working with Dynamic Links, here's a great [introduction video](https://www.youtube.com/watch?v=KLBjAg6HvG0) from Firebase's Firecast series on YouTube. Note, we will outline most of the steps covered in this tutorial below!
192-
193191
#### Start by going to the [Firebase Console](https://console.firebase.google.com) and navigate to your project:
194192
- Select the **Auth** panel and then click the **Sign In Method** tab.
195193
- Click **Email/Password** and ensure it is enabled.
@@ -208,14 +206,14 @@ As we mentioned above, we will need to configure dynamic links for this auth flo
208206
- Setup your short URL. Feel free to put whatever here, like "demo", "login, or "passwordless" for example. Click **Next**.
209207
- For the Deep Link URL, configure the URL to look like:
210208
> https://[insert an authorized domain]/login?email=email
211-
>For the authorized domain ⬆, go to the the Authentication tab, then click the "Sign-in method", and scroll down to the "Authorized domains" section. Copy the domain that looks like `[the app's name].firebaseapp.com`. Paste this entire domain into the Deep Link we are creating above. You can also instead allowlist the dynamic links URL prefix and use that here as well.
209+
>For the authorized domain ⬆, go to the the Authentication tab, then click the "Settings" tab, and select the "Authorized domains" section. Copy the domain that looks like `[the app's name].firebaseapp.com`. Paste this entire domain into the Deep Link we are creating above. You can also instead allowlist the dynamic links URL prefix and use that here as well.
212210
- On step 3, **Define link behavior for iOS**, select **Open the deep link in your iOS App** and make sure your app is selected in the drop down.
213211
- Configure the following steps as you please and then hit **Create**!
214212

215213
- Dynamic links use your app's bundle identifier as a url scheme by default. In Xcode, [add a custom URL scheme for your **bundle identifier**](https://developers.google.com/identity/sign-in/ios/start-integrating#add_a_url_scheme_to_your_project).
216214
- Last todo! Navigate to [`sendSignInLink()`](https://github.com/firebase/quickstart-ios/blob/main/authentication/AuthenticationExample/View%20Controllers/Other%20Auth%20Method%20Controllers/PasswordlessViewController.swift#L39) in [`PasswordlessViewController.swift`](https://github.com/firebase/quickstart-ios/blob/main/authentication/AuthenticationExample/View%20Controllers/Other%20Auth%20Method%20Controllers/PasswordlessViewController.swift). Within the method, there is a `stringURL` constant. Paste in the long deeplink you created from the steps above for the `authroizedDomain` property above the method. It should look something like:
217215
```swift
218-
let stringURL = "https://\(authorizedDomain).firebaseapp.com/login?email=\(email)"
216+
let stringURL = "https://\(authorizedDomain)/login"
219217
```
220218

221219
- Run the app on your device or simulator.
@@ -241,11 +239,9 @@ When the user receives the verification email, they can open the link contained
241239

242240
private func handleIncomingDynamicLink(_ incomingURL: URL) {
243241

244-
DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { (dynamicLink, error) in
245-
246242
// Handle the potential `error`
247243

248-
guard let link = dynamicLink?.url?.absoluteString else { return }
244+
let link = incomingURL.absoluteString
249245

250246
// Here, we check if our dynamic link is a sign-link (the one we emailed our user!)
251247
if Auth.auth().isSignIn(withEmailLink: link) {
@@ -255,7 +251,6 @@ private func handleIncomingDynamicLink(_ incomingURL: URL) {
255251

256252
// Post a notification to the PasswordlessViewController to resume authentication
257253
NotificationCenter.default.post(Notification(name: Notification.Name("PasswordlessEmailNotificationSuccess")))
258-
}
259254
}
260255
}
261256
```

0 commit comments

Comments
 (0)