Destiny-Ed / Firebase-Authentication-Tutorial-project

5 stars 3 forks source link

Request : Apple authentication #1

Open zakblacki opened 3 years ago

zakblacki commented 3 years ago

Thanks for sharing, please add apple login as well

zakblacki commented 3 years ago

You don't have to provide live example some basic snippet code example would be helpful to know

also there is a bug with flutter_facebook_authcould be helpful to know for others basically if someone using get_strorageit won't work with this package as discussed in here

So if you could give us another example with flutter_login_facebookor flutter_facebook_loginpackage highly appreciated thanks

Edit : turn out I had to follow facebook documentation edit androidmanifest and style file

zakblacki commented 3 years ago

Here is the code for Apple authentication using sign_in_with_apple I haven't tried yet on mac but it should work

`Platform.isIOS ? Padding(
                                padding: const EdgeInsets.all(18.0),
                                child: SignInWithAppleButton(
                                  onPressed: () async {
                                    final appleIdCredential = await SignInWithApple.getAppleIDCredential(
                                      scopes: [
                                        AppleIDAuthorizationScopes.email,
                                        AppleIDAuthorizationScopes.fullName,
                                      ],
                                    );
                                    final oAuthProvider = OAuthProvider('apple.com');
                                    final credential = oAuthProvider.credential(
                                      idToken: appleIdCredential.identityToken,
                                      accessToken: appleIdCredential.authorizationCode,
                                    );
                                    await FirebaseAuth.instance.signInWithCredential(credential);
                                    print(credential);
                                  },
                                ),
                              ) : Text(''),`
Destiny-Ed commented 3 years ago

Thanks, I'll check it out.

On Thu, Jun 17, 2021, 16:33 Zak @.***> wrote:

Here is the code for Apple authentication using sign_in_with_apple I haven't tried yet on mac but it should work

Platform.isIOS ? Padding( padding: const EdgeInsets.all(18.0), child: SignInWithAppleButton( onPressed: () async { final appleIdCredential = await SignInWithApple.getAppleIDCredential( scopes: [ AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName, ], ); final oAuthProvider = OAuthProvider('apple.com'); final credential = oAuthProvider.credential( idToken: appleIdCredential.identityToken, accessToken: appleIdCredential.authorizationCode, ); await FirebaseAuth.instance.signInWithCredential(credential); print(credential); }, ), ) : Text(''),

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Destiny-Ed/Firebase-Authentication-Tutorial-project/issues/1#issuecomment-863342248, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN4RXI5LYBFAMYH36Y2CWMTTTIIUZANCNFSM46ZHSWCQ .