Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[auth] anonymous auth missing 'firebase' providerData #140

Closed
Salakar opened this issue Jul 17, 2017 · 7 comments
Closed

[auth] anonymous auth missing 'firebase' providerData #140

Salakar opened this issue Jul 17, 2017 · 7 comments

Comments

@Salakar
Copy link
Member

Salakar commented Jul 17, 2017

[READ] Step 1: Are you in the right place?

  • For issues or feature requests related to the code in this repository
    file a Github issue.
    • If this is a feature request make sure the issue title starts with "FR:".
  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Xcode version: Any
  • Firebase SDK version: 4.0.2
  • Library version: Any
  • Firebase Product: auth (auth, database, storage, core, messaging, etc)

[REQUIRED] Step 3: Describe the problem

FIRUser.providerData array is empty when signed in anonymously, however the android sdk returns 1 array item when signed in anonymously with the following properties in the map/dictionary:

image

Steps to reproduce:

Sign in anonymously. See code below.

Relevant Code:

FIRApp *firApp = [FIRApp appNamed:@"foobar"];

[[FIRAuth authWithApp:firApp] signInAnonymouslyWithCompletion:^(FIRUser *user, NSError *error) {
  // user.providerData array is empty
}];

Have found this issue whilst working on the react native firebase implementation, library specific code is as follows:

@XiangtianDai
Copy link
Contributor

@Salakar I'm sorry that Firebase Auth's implementations for the list of providers are inconsistent between platforms. On both iOS and Web this implied "firebase" provider (which is represented as the user object itself) is omitted from the array, while on Android it is listed as an explicit provider in the array. At this moment I don't see how we can change any of the implementations without breaking existing developer code that may have already depended on them, so my suggestion is:

  • If you are on Android and want iOS behavior, filter out the "firebase" provider from the result array returned bygetProviderData() method.
  • If you are on iOS and want Android behavior, add the FIRUser instance itself to the beginning of the result array returned by providerData property getter.

@Salakar
Copy link
Member Author

Salakar commented Jul 18, 2017

@XiangtianDai ok, makes sense, will work around it to match the ios & web implementations,

Another couple inconsistency queries if I may:

  • FIROptions vs FirebaseOptions:
    • On the iOS implementation (FIROptions) it's possible to get and set the clientId.
    • On the android implementation (FirebaseOptions) there's no way to get the clientId on an initialised app, and, there's also no way to set the clientId via FirebaseOptions.Builder.
  • FIRApp vs FirebaseApp:
    • On the iOS implementation (FIRApp) it's possible to delete an initialised app via deleteApp.
    • On the android implementation (FirebaseApp) there's no way, or at least a documented way of deleting an initialised app.

I have some other inconsistency issues between ios & android and am unsure where to address these? (sorry if this is the wrong place 🙈 ) Right now though the ones above are my main concern - could you perhaps if possible advise on solutions/workarounds please?

@XiangtianDai
Copy link
Contributor

@davidair for FirebaseCore

@Salakar
Copy link
Member Author

Salakar commented Oct 3, 2017

@XiangtianDai @davidair any updates on my previous comments?

@morganchen12
Copy link
Contributor

@Salakar there's no workarounds for the two things you mentioned. It's likely that we can change Android to suit iOS behavior as a non-breaking change, since it just involves adding API stuff.

This is tracked internally at b/67354438, and isn't likely to be a priority for the time being.

@ryanwilson
Copy link
Member

@protocol86 - can you address whether or not the Android solution or iOS solution is the correct one here? If iOS is correct, we should close this bug and address it internally on the Android side since there's no actionable items for this repo.

@protocol86
Copy link
Contributor

The iOS library exhibits the expected functionality. A bug has been filed against the Android SDK, who will release it as soon as is feasible (though they are somewhat limited due to this being a breaking change).

@firebase firebase locked and limited conversation to collaborators Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants