/
FIRAuthMigrator.h
65 lines (56 loc) · 2.25 KB
/
FIRAuthMigrator.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// Copyright (c) 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <Foundation/Foundation.h>
@import Firebase;
@import FirebaseAuth;
@interface FIRAuthMigrator : NSObject
/**
* Creates a new FIRAuthMigrator for the default FIRApp.
*/
+ (instancetype _Nonnull)authMigrator NS_SWIFT_NAME(authMigrator());
/**
* Creates a new FIRAuthMigrator for the given FIRApp.
*/
+ (instancetype _Nonnull)authMigratorWithApp:(FIRApp * _Nonnull)app;
/**
* Looks up whether a user is logged in with a legacy Firebase SDK and logs them in with the current
* Firebase SDK. This works as follows:
* 1. Looks up the legacy auth token in the keychain.
* 2. Sends the legacy token to a Firebase server to exchange it for a new auth token.
* 3. Uses the new auth token to log in the user.
* 4. Removes the legacy auth token from the keychain.
*
* If a user is already logged in with the new Firebase SDK, then the legacy auth token will be
* removed, but the logged in user will not be affected.
*
* If the Firebase server determines that the legacy auth token is invalid, it will be removed, and
* the user will not be logged in.
*
* @param completion Callback for when the exchange is complete. user can be nil if either:
* 1. There was a (temporary or permanent) failure, as indicated by error, OR
* 2. There was no legacy auth token present.
*/
- (void)migrate:(void (^ _Nullable)(FIRUser * _Nullable user,
NSError * _Nullable error))completion;
/**
* Removes the legacy Firebase auth token from the keychain, if present.
*/
- (void)clearLegacyAuth;
/**
* Returns whether a user is logged in on this device with a legacy Firebase SDK.
*/
- (BOOL)hasLegacyAuth:(NSError * _Nullable * _Nullable)error;
@end