-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
[REQUIRED] Step 2: Describe your environment
- Xcode version: 11.0 beta (11M336w)
- Firebase SDK version: 6.0
- Firebase Component: Auth
- Component version: 6.0
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
In this library, a call to fetchProvidersForEmail()
with an email that is not registered returns null. That's because the HTTP response to createAuthURI()
is
"kind" : "identitytoolkit#CreateAuthUriResponse"
"sessionId" : "xxxxxxxxxxx"
"registered" : NO
And when this is parsed into a FIRCreateAuthURIResponse
this function sets _allProviders to null:
firebase-ios-sdk/Firebase/Auth/Source/Backend/RPC/FIRCreateAuthURIResponse.m
Lines 23 to 32 in 331f651
- (BOOL)setWithDictionary:(NSDictionary *)dictionary | |
error:(NSError *_Nullable *_Nullable)error { | |
_providerID = [dictionary[@"providerId"] copy]; | |
_authURI = [dictionary[@"authUri"] copy]; | |
_registered = [dictionary[@"registered"] boolValue]; | |
_forExistingProvider = [dictionary[@"forExistingProvider"] boolValue]; | |
_allProviders = [dictionary[@"allProviders"] copy]; | |
_signinMethods = [dictionary[@"signinMethods"] copy]; | |
return YES; | |
} |
However, the android version of this library returns an empty list. I'm not sure how its implemented there because it's not been published in https://github.com/firebase/firebase-android-sdk.
This causes a problem in the FlutterFire auth package because the response seems expected to be an array, not null, as you can see in this test: https://github.com/flutter/plugins/blob/f401ca1ce107f3ac7a589715cf69e101ac9f40d3/packages/firebase_auth/test/firebase_auth_test.dart#L277-L281
This isn't an integration test which is why it didn't throw an error.
I think fetchProvidersForEmail()
should return an empty array if there are no providers, so that it matches the Android behavior and the expectations of the FlutterFire package. If that sounds right I can create a PR, but that might be better done by someone who can see the internal Android code.