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

fix(auth): deprecate FirebaseAuth.instanceFor's persistence parameter #11259

Merged
merged 1 commit into from Sep 18, 2023

Conversation

exaby73
Copy link
Contributor

@exaby73 exaby73 commented Jul 11, 2023

Description

When the plugin is initialised by Flutter, initialise FirebaseAuth without any persistence. This causes a error to be thrown when calling FirebaseAuth.instanceFor with a persistence value as firebase_auth tries to reinitialise the auth instance with a new persistence.

We cannot use setPersistence to fix this since it's a Future and instanceFor is synchronous, and the user cannot provide the persistence they want before the plugin is initialised. Therefore, the persistence parameter is being deprecated and users are expected to call setPersistence separately to set the persistence of the auth object.

Only affects web

Related Issues

Fixes #10961

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@exaby73 exaby73 marked this pull request as ready for review July 11, 2023 13:58
@exaby73 exaby73 closed this Aug 16, 2023
@exaby73 exaby73 changed the title fix(auth): error thrown when instanceFor is called with persistance on web fix(auth): deprecate FirebaseAuth.instanceFor's persistance parameter Aug 16, 2023
@exaby73 exaby73 reopened this Aug 16, 2023
@russellwheatley russellwheatley changed the title fix(auth): deprecate FirebaseAuth.instanceFor's persistance parameter fix(auth): deprecate FirebaseAuth.instanceFor's persistence parameter Sep 5, 2023
Comment on lines +44 to +52
factory FirebaseAuth.instanceFor({
required FirebaseApp app,
@Deprecated(
'Will be removed in future release. Use setPersistence() instead.',
)
Persistence? persistence,
}) {
return _firebaseAuthInstances.putIfAbsent(app.name, () {
return FirebaseAuth._(app: app, persistence: persistence);
return FirebaseAuth._(app: app);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove the behavior, it's not a deprecation but a straight removal (breaking) even if we are warning the user.
we should just put the warning now, and remove the behavior at the next breaking release

@russellwheatley russellwheatley merged commit a1966e8 into master Sep 18, 2023
23 of 39 checks passed
@russellwheatley russellwheatley deleted the issue-10961 branch September 18, 2023 16:53
@firebase firebase locked and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants