Android Sign in with apple and firebase flutter
Use the following flutter code to Android Sign in with apple and firebase flutter.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Future<FirebaseUser> signInWithApple() async { var redirectURL = "https://SERVER_AS_PER_THE_DOCS.glitch.me/callbacks/sign_in_with_apple"; var clientID = "AS_PER_THE_DOCS"; final appleIdCredential = await SignInWithApple.getAppleIDCredential( scopes: [ AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName, ], webAuthenticationOptions: WebAuthenticationOptions( clientId: clientID, redirectUri: Uri.parse( redirectURL))); final oAuthProvider = OAuthProvider(providerId: 'apple.com'); final credential = oAuthProvider.getCredential( idToken: appleIdCredential.identityToken, accessToken: appleIdCredential.authorizationCode, ); final authResult = await SignInUtil.firebaseAuth.signInWithCredential(credential); return authResult.user; } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.