Users don't want to invent yet another password, and many of them don't remember their Apple or Google password either. They do know how to tap "Continue with Apple". For a consumer app, social sign-in is one of the strongest levers against users quitting during setup.
AIR has no built-in support for either. Here is how we added both to our own AIR apps on iOS, Android and macOS with KlugAuth, and what we ran into.
The flow
- The app shows the system sign-in sheet: Apple's on iOS and macOS, Google's Credential Manager on Android.
- The user confirms. The extension returns an identity token (a signed JWT) to ActionScript.
- The app sends the token to your server. The server verifies the signature against Apple's or Google's public keys, checks the audience (your app's client ID), and logs the user in or creates the account.
- The server never sees a password, and the app never stores one.
The token check belongs on the server. An app that trusts a token without verifying it can be fooled.
Sign in with Apple: what Apple expects
- Capability and entitlement. The App ID needs "Sign in with Apple", the app needs the entitlement
com.apple.developer.applesignin = [Default], and the provisioning profile must contain it. On the Mac this is easy to miss: if the profile was generated before the capability was enabled, the upload is refused. Regenerate the profile. - Apple requires Sign in with Apple if your app offers other third-party logins like Google (App Review guideline 4.8).
- Account deletion means revoking. If a user deletes their account, guideline 5.1.1(v) requires that you revoke their Apple token. Your server needs Apple's refresh token for that, so store it (encrypted) when the user signs in, and call Apple's revoke endpoint before deleting the account.
- Private relay e-mail. Users can hide their address. Apple then forwards mail from
…@privaterelay.appleid.comonly if your sending domain and addresses are registered in your developer account. - Apple on Android. If your users mix an iPhone and an Android tablet, they expect Apple there too. That works with Apple's web flow: a Services ID, a return URL on your server, and the browser.
Sign in with Google: what Google expects
- One OAuth client per platform, plus a web client for your server. The server verifies the token's audience against the web client ID.
- Android clients are bound to the signing certificate's SHA-1. Your debug key, your upload key and Google Play's app signing key are three different certificates. A login that works in your test build and fails in the Play Store version is almost always the missing Play signing SHA-1.
- Branding verification. Before the consent screen shows your app name instead of a project number, Google checks your home page and privacy policy. The privacy policy needs a section about Google user data, and the pages must be reachable for Google's crawler. A firewall or bot protection in front of your site can make the verification fail.
In the app
var auth:KlugAuth = KlugAuth.getInstance();
var nonce:String = KlugAuth.generateNonce();
auth.addEventListener( KlugAuthEvent.APPLE_SUCCESS, function( e:KlugAuthEvent ):void {
// e.identityToken (+ e.authorizationCode for the revoke token) -> your server
});
auth.addEventListener( KlugAuthEvent.GOOGLE_SUCCESS, function( e:KlugAuthEvent ):void {
// e.identityToken -> your server verifies the audience = your web client ID
});
auth.signInWithApple( nonce ); // system sheet on iOS and macOS
auth.signInWithGoogle( "YOUR_WEB_CLIENT_ID", nonce ); // Credential Manager on Android
Cancel and error events, the credential state check and the server side are in the KlugAuth documentation.
What it changed for us
Registration went from a form with a mailed verification code to two taps. Pairing a second device, for example to sign in on a tablet without typing anything, became a QR code scan (KlugRegister). Logins on old tablets without Face ID work with the system sheet instead of a forgotten password.
KlugAuth: Sign in with Apple and Google for Adobe AIR on iOS, Android and macOS. klughomesolutions.com/klugauth.html
More articles
- Shipping an AIR app to the Mac App Store and TestFlight
- Why AIR native extensions don't need a package manager
- One app, many native extensions – and they have to work together
- Two-way voice with echo cancellation in Adobe AIR
- Camera and H.264 live streaming in Adobe AIR, without AIR's camera
- Adobe AIR on iOS 27: the launch crash and how to ship anyway
- A distriqt alternative for Adobe AIR native extensions