Open
Description
Really need someone's help to figure this one out. Our app has started crashing on device, but during dev all is good on sims.
Narrowed it down to the listenForAuth method in XCode where the exception is being thrown - specifically it's the "userTokenError" event.
Firstly how should we be protecting against this crash scenario ? Im assuming we need to call reauthenticateWithCredentialForProvider() ? If yes, not sure where to put that call, in relation to the "listenForAuth" listener which we invoke on app startup (in an action).
Appreciate anyone's help/guidance on this, thanks.
RCT_EXPORT_METHOD(listenForAuth)
{
self->listening = true;
self->authListenerHandle =
[[FIRAuth auth] addAuthStateDidChangeListener:^(FIRAuth *_Nonnull auth,
FIRUser *_Nullable user) {
if (user != nil) {
// User is signed in.
[self userPropsFromFIRUserWithToken:user
andCallback:^(NSDictionary *userProps, NSError * error) {
if (error != nil) {
[self
sendJSEvent:AUTH_CHANGED_EVENT
props: @{
**crashing here ====>** @"eventName": @"userTokenError",
@"authenticated": @((BOOL)false),
@"errorMessage": [error localizedFailureReason]
}];
} else {
[self
sendJSEvent:AUTH_CHANGED_EVENT
props: @{
@"eventName": @"user",
@"authenticated": @((BOOL)true),
@"user": userProps
}];
}
}];
Metadata
Metadata
Assignees
Labels
No labels