You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 2, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: .github/README.md
+47-22Lines changed: 47 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -186,7 +186,7 @@ Target for all authentication related operations.
186
186
-[x] Authentication by Apple Id
187
187
-[x] Error Handling
188
188
-[x] Link Anonymous and authenticated Accounts
189
-
-[] Authentication by Email and Password
189
+
-[x] Authentication by Email and Password
190
190
-[x] Sign out and Deleting an Account
191
191
-[x] UIKit-View for handling SignInWithApple-Requests
192
192
@@ -208,7 +208,7 @@ AuthenticationManager.email = "[email protected]" // email is overwritten and c
208
208
209
209
210
210
##### Configuration
211
-
By default the `AuthenticationManager`is using Sign In With Apple and allows also anonymous authentication. If you want to disable it, you can use a custom configuration object. With that the AuthenticationManager needs to be initialized on App Start.
211
+
By default, the `AuthenticationManager`allows three authentication methods: Sign in with Email and Password, by using the Apple ID and anonymous login. If you want to restrict the providers, you can use a custom configuration object. With that, the AuthenticationManager needs to be initialized on App Start.
212
212
213
213
You can also link a repository where you manage your users details. If you subclass the `UserRepositoryProtocol`your user's details with the user details you get during the authentication process.
AuthenticationManager.updateMail(currentPassword: "123", newMail: "[email protected]") { error in }
281
+
AuthenticationManager.updatePassword(currentPassword: "123", newPassword: "456") { error in }
282
+
```
283
+
284
+
257
285
##### Authenticate by using Apple Id
258
286
259
-
The Authentication Manager controls the whole authentication flow and returns you the handled error without any further work.
287
+
The Authentication Manager controls the whole authentication flow and returns the handled error without any further work.
260
288
261
289
###### SwiftUI:
290
+
262
291
```Swift
263
292
importFirebaseAuthenticationManager
264
293
importAuthenticationServices
@@ -391,11 +420,22 @@ AuthenticationManager.signOut { error in
391
420
##### Delete Account
392
421
393
422
You can delete a user's account in Firebase.
394
-
This can require a reauthentication before executing this method.
423
+
This can require a reauthentication before executing this method which is done automatically for users who signed in with email and password.
395
424
396
425
If your user signed in with its Apple-Account, this requires involving the UI to receive the status of authentication. We don't handle this error (yet), so we advise you to execute an additional login manually before accessing this function.
397
426
398
427
```Swift
428
+
// Account is related to Email and Password
429
+
AuthenticationManager.deleteAccount(currentPassword: "123") { error in
430
+
iflet error {
431
+
// Check detailed Error Response
432
+
} else {
433
+
// Deletion of Account was successful
434
+
// If you stored your user's data in a database, don't forget to implement deleting it separately.
435
+
}
436
+
}
437
+
438
+
// Account is related to Apple ID
399
439
AuthenticationManager.deleteAccount { error in
400
440
iflet error {
401
441
// Check detailed Error Response
@@ -443,7 +483,7 @@ class UserRepository: UserRepositoryProtocol {
443
483
444
484
It is recommended to check a user's authorization status on app start, or possibly before sensitive transactions, since these could be changed outside of your app.
445
485
446
-
You can simplify this Authorization-Flow by implementing the `UserRepositoryProtocol`. We provide two functions, choose the one you need according to your defined Authentication Providers.
486
+
You can simplify this Authorization-Flow by implementing the `UserRepositoryProtocol`.
447
487
448
488
If you stored your users details in a remote database, you might want to fetch it after the authorization was successful.
449
489
For this you can implement the `fetchCurrentUser`-Method, which is executed automatically on successful authorization.
@@ -453,21 +493,6 @@ class UserRepository: UserRepositoryProtocol {
453
493
454
494
// Custom Function for checking Authorization -> can be called anywhere in your app where you need it
455
495
funccheckAuthState() {
456
-
// Depending on your Authentication Provider choose
457
-
458
-
// (a) if you support anonymous users
459
-
self.checkAuthorizationWithAnonymousUser { error in
460
-
iflet error {
461
-
// Handle Error
462
-
463
-
// We recommend signing out
464
-
AuthenticationManager.signOut { _in }
465
-
}
466
-
467
-
// if no error occured fetchCurrentUser() is called automatically
// Account is reauthenticated to perform some security-sensitive actions (deleting account for now, later may be password change or mail-adress-change)
0 commit comments