Skip to content
Tjitjing Blog

Tjitjing Blog

This is my blog on technology related things and maybe some other stuff too…

  • Blog
  • About Me

Month: January 2020

Posted on January 29, 2020

Tutorial: Sign in with Apple (SIWA) and Ionic, Cordova, AngularFire, Firebase

Since a few months back Apple does not approve apps that have only social media login (ie not good old fashioned username and password) unless it also has “Sign in with Apple” (SIWA)

All this is probably too new for it to be any good tutorials or examples available, at least I could not find any and I spent quite some time looking. I also spent quite a few hours getting it to work, but here it is:

Solution

I used the plugin cordova-plugin-apple-login (version 1.0.0) so go ahead and install it using:

npm i cordova-plugin-apple-login
ionic cordova plugin add 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 on your page:

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);
alert('error:' + JSON.stringify(error));
});
});

}

This was done using Ionic 4 / Angular, AngularFire2 5.30 and the cordova-plugin-apple-login 1.0.0

Configuration

You also have to do some configurations…

-> 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

If you want to support Android and or Web / PWA, you will need to do some more configuring.

Did this solution help you?

Please comment if it did, or if you had a problem with it. Also if you got it working (or not) using other versions of plugins, frameworks etc or if you found a better solution – it will help others!

P.s. I also posted this solution to Stack Overflow (my first anwer there, yay!)


Recent Comments

  • adal2404 on MySql.Data.MySqlClient.MySqlException: Parameter ‘@id’ must be defined
  • Ieva on Windows cannot connect to iPhone Personal Hotspot
  • Christina on MySql.Data.MySqlClient.MySqlException: Parameter ‘@id’ must be defined
  • sbobet mobile on OpenDKIM: error loading key `default._domainkey.mydomain.com’
  • Uriel on Tutorial: Sign in with Apple (SIWA) and Ionic, Cordova, AngularFire, Firebase

Recent Posts

  • Instruction for Apple App Store upload (from an App Developer to Client)
  • Tutorial: Sign in with Apple (SIWA) and Ionic, Cordova, AngularFire, Firebase
  • Ionic Cordova Error – ENOENT: no such file or directory
  • Xcode and Bitbucket gives Authentication Failed
  • Solved: Email not received and no NDR on Office365 Microsoft online

Tags

  • .NET Framework 4.0
  • 64-bit
  • 404
  • Android
  • Angular
  • AngularFire
  • AngularFire2
  • Apple Developer
  • App Store
  • App Upload
  • ASP.NET
  • ASP.NET 4.0
  • ASP.NET Chart Control
  • ASP.NET Routing
  • Backup
  • Barack Obama
  • Bitbucket
  • BOINC
  • BPOS
  • Code snippet
  • Cordova
  • debian
  • Dell
  • DRAC
  • Example
  • Exchange Online
  • GIMP
  • Google
  • IIS7
  • invites
  • Ionic
  • iOs
  • Java
  • Lotus Notes
  • Lotusscript
  • Microsoft Online Services
  • MySQL
  • Office 365
  • opendkim
  • PHP
  • Scripting
  • Windows 10
  • Windows Server
  • Windows Server 2008
  • Windows tools

Categories

  • .NET
  • Acer
  • ActiveSync
  • Amazon S3
  • App Development
  • Apple
  • ASP.NET
  • Backup
  • Barack Obama
  • Better Place
  • Bitbucket
  • Blogger
  • Cordova
  • Debian
  • DNS
  • Evernote
  • Facebook
  • Firefox
  • GIMP
  • Good stuff
  • Google
  • Google AdWords
  • Google Maps
  • Hardware
  • HTC
  • IIS (Internet Information Server)
  • Internet Explorer
  • Ionic Framework
  • Kiss
  • Lotus Notes
  • Lotusscript
  • Microsoft Exchange
  • Mobile Internet
  • Mobile Phone
  • MySQL
  • Office 2003
  • Office 2007
  • Office 365
  • Outlook
  • PHP
  • Postfix
  • Remote Desktop Connection
  • Security
  • Server Admin
  • SharePoint
  • Sony Ericsson
  • SQL Server
  • Thailand
  • UFO
  • Uncategorized
  • VB.NET
  • Windows
  • Windows Mobile
  • Windows Server 2008
  • Windows Vista
  • Word as Editor in Lotus Notes
  • World Community Grid
  • Xcode

Archives

  • February 2020
  • January 2020
  • December 2018
  • February 2018
  • October 2016
  • July 2016
  • November 2015
  • October 2015
  • August 2015
  • November 2014
  • September 2014
  • June 2014
  • March 2014
  • September 2013
  • May 2013
  • April 2013
  • August 2012
  • March 2012
  • February 2012
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • March 2011
  • February 2011
  • January 2011
  • November 2010
  • October 2010
  • September 2010
  • July 2010
  • June 2010
  • May 2010
  • February 2010
  • December 2009
  • November 2009
  • October 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • August 2008
  • June 2008
  • May 2008
  • April 2008
  • February 2008
  • January 2008
  • October 2007
  • July 2007
  • April 2007
  • March 2007
  • February 2007
  • October 2006
  • September 2006
  • August 2006
  • June 2006
  • May 2006
  • April 2006
Proudly powered by WordPress