File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 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 {
8080 return promisify ( 'signInWithProvider' ) ( provider , authToken , authSecret ) ;
8181 }
8282
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+
8392 /**
8493 * Reauthenticate a user with a third-party authentication provider
8594 * @param {string } provider The provider name
Original file line number Diff line number Diff line change @@ -28,6 +28,27 @@ @implementation Firestack
2828 }
2929}
3030
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+
3152RCT_EXPORT_METHOD (signInWithProvider:
3253 (NSString *)provider
3354 token:(NSString *)authToken
You can’t perform that action at this time.
0 commit comments