File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,15 @@ export default class Firestack {
80
80
return promisify ( 'signInWithProvider' ) ( provider , authToken , authSecret ) ;
81
81
}
82
82
83
+ /**
84
+ * Sign the user in with a custom auth token
85
+ * @param {string } customToken A self-signed custom auth token.
86
+ * @return {Promise } A promise resolved upon completion
87
+ */
88
+ signInWithCustomToken ( customToken ) {
89
+ return promisify ( 'signInWithCustomToken' ) ( customToken ) ;
90
+ }
91
+
83
92
/**
84
93
* Reauthenticate a user with a third-party authentication provider
85
94
* @param {string } provider The provider name
Original file line number Diff line number Diff line change @@ -28,6 +28,27 @@ @implementation Firestack
28
28
}
29
29
}
30
30
31
+ RCT_EXPORT_METHOD (signInWithCustomToken:
32
+ (NSString *)customToken
33
+ callback:(RCTResponseSenderBlock) callback)
34
+ {
35
+ [[FIRAuth auth ]
36
+ signInWithCustomToken: customToken
37
+ completion: ^(FIRUser *user, NSError *error) {
38
+
39
+ if (user != nil ) {
40
+ NSDictionary *userProps = [self userPropsFromFIRUser: user];
41
+ callback (@[[NSNull null ], userProps]);
42
+ } else {
43
+ NSDictionary *err =
44
+ [self handleFirebaseError: @" signinError"
45
+ error: error
46
+ withUser: user];
47
+ callback (@[err]);
48
+ }
49
+ }];
50
+ }
51
+
31
52
RCT_EXPORT_METHOD (signInWithProvider:
32
53
(NSString *)provider
33
54
token:(NSString *)authToken
You can’t perform that action at this time.
0 commit comments