Interface AppleSignInNative
Service-provider interface for native Sign in with Apple. The iOS port
supplies a class com.codename1.social.AppleSignInNativeImpl that wraps
ASAuthorizationAppleIDProvider; AppleSignIn loads it via
Class.forName at first use. Cn1libs that want to plug in their own
implementation can register one with AppleSignIn.setNative(AppleSignInNative)
-- this interface does not extend
NativeInterface because AppleSignIn is part of
the core framework and the iOS impl talks to native code via
IOSImplementation.nativeInstance, not through NativeLookup.
The native side serialises its result as a single pipe-delimited string to keep the bridge boundary primitive-only:
{idToken}|{authorizationCode}|{user}|{givenName}|{familyName}|{email}
null segments are sent as empty strings. user is the stable opaque
identifier Apple returns; givenName / familyName / email are only
populated on the first authorization (Apple does not re-send the
profile on subsequent logins). The Java side persists them.
- Since:
- 8.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif the user is currently signed in (i.e. the previously returned credential is still valid in the Apple keychain).booleantrueif this implementation is usable on the current device / OS version.Starts the system Sign-in-with-Apple sheet.voidsignOut()Clears the current Apple credential from the app's keychain entry.
-
Method Details
-
isSupported
boolean isSupported()trueif this implementation is usable on the current device / OS version. iOS 13+ returnstrue; older iOS, non-iOS platforms, or missing entitlement returnsfalsesoAppleSignInfalls back to its web OIDC flow. -
signIn
Starts the system Sign-in-with-Apple sheet. The call blocks the calling thread until the user completes or cancels.
Parameters
scopes: Space-separated scope list (e.g."name email").nonce: SHA-256 hash of the per-request nonce, base64url encoded. Apple binds this to the returned ID token'snonceclaim.
-
isLoggedIn
boolean isLoggedIn()Returnstrueif the user is currently signed in (i.e. the previously returned credential is still valid in the Apple keychain). -
signOut
void signOut()Clears the current Apple credential from the app's keychain entry. Apple does not provide an explicit sign-out -- this only removes the local credential association so the nextsignIn(String, String)will prompt again.
-