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

[firebase_auth] Added Oauth for generic provider for iOS and Android devices #1526

Merged
merged 52 commits into from Dec 17, 2019

Conversation

@zariweyo
Copy link
Contributor

zariweyo commented Dec 1, 2019

Description

This PR enable the to use sign-in-ios to link with a firebase authentication account. Only run on iOS at the moment, but it's very important because Apple reject Apps in the stores wich implements other third-party login service but does not offer Sign in with Apple (Guideline 4.8 - Design - Sign in with Apple)

Related Issues

This PR resolve this issue in firebase_auth: Sign in with Apple #1434 for iOS.
#1434

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • If the pull request affects only one plugin, the PR title starts with the name of the plugin in brackets (e.g. [cloud_firestore])
  • 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 (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • 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 (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.
@googlebot googlebot added the cla: yes label Dec 1, 2019
@kroikie kroikie self-assigned this Dec 2, 2019
@collinjackson collinjackson self-requested a review Dec 2, 2019
Copy link
Collaborator

collinjackson left a comment

Thank you for contributing this! Since Apple sign in is supported on Android as well, would you be willing to add an Android implementation?

See https://firebase.google.com/docs/auth/android/apple

@zariweyo

This comment has been minimized.

Copy link
Contributor Author

zariweyo commented Dec 3, 2019

Ok, I could do it. But at now It's not a requirement in my project, I do this because Apple reject my publishment and I needed this change. I put this change in my workflow and I'll do it for Android in other PR. This PR it's only for iOS (I'm sure there is a lot of development that need this change)

@zariweyo

This comment has been minimized.

Copy link
Contributor Author

zariweyo commented Dec 4, 2019

I need to do 2 PR, because I have cross dependencies.

I close this to make a PR for firebase_auth_platform_interface before, and then, I return to make a new PR to solve this

@zariweyo zariweyo closed this Dec 4, 2019
zariweyo added 2 commits Dec 4, 2019
@collinjackson

This comment has been minimized.

Copy link
Collaborator

collinjackson commented Dec 12, 2019

If you want to take a crack at adding an implementation, I'll look at what is possible testing-wise. We should have an integration test that covers both iOS and Android ideally (though it doesn't need to specifically connect to Apple).

zariweyo added 3 commits Dec 13, 2019
….0 com.google.firebase:firebase-auth:19.2.0 and added support OAuthProvider for generic providerId
@zariweyo

This comment has been minimized.

Copy link
Contributor Author

zariweyo commented Dec 13, 2019

You are right. I did implement the Android version, and I probe with google provider.

  Future<bool> signInGoogle(GoogleSignInAuthentication googleAuth) async {
    Completer completer = new Completer<bool>();
    OAuthProvider oAuthProvider = new OAuthProvider(providerId: "google.com");
    final AuthCredential credential = oAuthProvider.getCredential(
      idToken: googleAuth.idToken,
      accessToken: googleAuth.accessToken,
    );

    try {
      final AuthResult _res = await _firebaseAuth.signInWithCredential(credential);
      completer.complete(true);
    } catch(err) {
        completer.completeError(err);
    }

    return completer.future;
  }

It works perfectly. So I'm going to change the PR title. Now this is a generic solution of OAuth authentication for Android and iOS.

@zariweyo zariweyo changed the title [firebase_auth] Added Oauth for generic provider and solve auth for iOS devices [firebase_auth] Added Oauth for generic provider and solve auth for iOS and Android devices Dec 13, 2019
@zariweyo zariweyo changed the title [firebase_auth] Added Oauth for generic provider and solve auth for iOS and Android devices [firebase_auth] Added Oauth for generic provider for iOS and Android devices Dec 13, 2019
zariweyo added 5 commits Dec 13, 2019
…xml in examples to solve issue of incompatibilities
…xml in examples to solve issue of incompatibilities
@Ahmadre

This comment has been minimized.

Copy link

Ahmadre commented Dec 13, 2019

Everything is working perfectly 👍 . I am using this branch in production. When will this PR be merged?

@zariweyo

This comment has been minimized.

Copy link
Contributor Author

zariweyo commented Dec 13, 2019

I hope soon. This last change I think that is the complete solution.

@davidlahuta

This comment has been minimized.

Copy link

davidlahuta commented Dec 14, 2019

Thank you for this PR.

@zariweyo zariweyo requested a review from collinjackson Dec 14, 2019
@zariweyo

This comment has been minimized.

Copy link
Contributor Author

zariweyo commented Dec 14, 2019

With last commits, Now everything is done, right?

@collinjackson collinjackson merged commit 34ec274 into FirebaseExtended:master Dec 17, 2019
11 checks passed
11 checks passed
analyze Task Summary
Details
build-apks+java-test+firebase-test-lab PLUGIN_SHARDING:--shardIndex 0 --shardCount 2 Task Summary
Details
build-apks+java-test+firebase-test-lab PLUGIN_SHARDING:--shardIndex 1 --shardCount 2 Task Summary
Details
build-ipas+drive-examples PLUGIN_SHARDING:--shardIndex 0 --shardCount 4 Task Summary
Details
build-ipas+drive-examples PLUGIN_SHARDING:--shardIndex 1 --shardCount 4 Task Summary
Details
build-ipas+drive-examples PLUGIN_SHARDING:--shardIndex 2 --shardCount 4 Task Summary
Details
build-ipas+drive-examples PLUGIN_SHARDING:--shardIndex 3 --shardCount 4 Task Summary
Details
cla/google All necessary CLAs are signed
format Task Summary
Details
publishable Task Summary
Details
test Task Summary
Details
@EliasDeuss

This comment has been minimized.

Copy link

EliasDeuss commented Dec 20, 2019

@zariweyo Getting a PlatformExeption ERROR_INTERNAL_ERROR . Following this article https://medium.com/@karlwhiteprivate/flutter-firebase-sign-in-with-apple-c99967df142f

@zariweyo

This comment has been minimized.

Copy link
Contributor Author

zariweyo commented Dec 20, 2019

@EliasDeuss this PR is closed. Please, report that issue yo the article's author.

muhleder added a commit to muhleder/flutterfire that referenced this pull request Dec 21, 2019
chen-yumin added a commit to chen-yumin/flutterfire that referenced this pull request Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.