Issue
Is there any possibility to integrate sign in by apple with firebase-x or angularfire?
My app was revoked due to this, i thinking what should i do now. I'm using ionic 4 and cordova. I can use sign in by apple plugin, but how can i add user to user lists after singing in? Have some one do this?
Thank you
Solution
Just had the same problem as you and spent quite a few hours to figure this out but finally got it working using Ionic 4/Angular and Angularfire by using this plugin: cordova-plugin-apple-login
Note that there is no Ionic Native wrapper for the plugin, so you have to declare it instead of importing it:
declare var SignInWithApple: any;
This is the login function:
loginWithApple() {
SignInWithApple.request({requestedScopes: [ SignInWithApple.Scope.Email, SignInWithApple.Scope.FullName ]})
.then((appleCredential) => {
const credential = new firebase.auth.OAuthProvider('apple.com').credential(appleCredential.identityToken);
this.afAuth.auth.signInWithCredential(credential)
.then((response) => {
console.log('Login successful');
})
.catch((error) => {
console.log(error);
});
});
}
Note that you also have to do some config:
- Xcode: Add capability for Sign in with Apple
- Apple Developer: Add Services id
- Firebase console (Add Sign-in method for Apple, leave all fields blank if you only use on iOS)
Hope this helps!
Answered By - maxfloden
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.