-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirebaseAuthUser+.swift
More file actions
39 lines (36 loc) · 996 Bytes
/
Copy pathFirebaseAuthUser+.swift
File metadata and controls
39 lines (36 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// FirebaseAuthUser+.swift
// DevLogInfra
//
// Created by 최윤진 on 11/3/25.
//
import Foundation
import FirebaseAuth
import DevLogData
extension FirebaseAuth.User {
func makeResponse(
providerID: AuthProviderID,
fcmToken: String? = nil,
accessToken: String? = nil
) -> AuthDataResponse {
return AuthDataResponse(
uid: self.uid,
displayName: self.displayName,
email: self.email,
providers: self.providerData.map { $0.providerID },
providerID: providerID.rawValue,
fcmToken: fcmToken,
accessToken: accessToken
)
}
}
extension Error {
var isFirebaseCredentialAlreadyInUse: Bool {
let nsError = self as NSError
guard nsError.domain == AuthErrorDomain,
let authErrorCode = AuthErrorCode(rawValue: nsError.code) else {
return false
}
return authErrorCode == .credentialAlreadyInUse
}
}