public 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.
Methods
public abstract boolean isSupported() | true if this implementation is usable on the current device / OS version. |
public abstract String signIn(String scopes, String nonce) | Starts the system Sign-in-with-Apple sheet. |
public abstract boolean isLoggedIn() | Returns true if the user is currently signed in (i.e. the previously returned credential is still valid in the Apple keychain). |
public abstract void signOut() | Clears the current Apple credential from the app’s keychain entry. |
Method details
isSupported
public abstract boolean isSupported()true if this implementation is usable on the current device / OS
version. iOS 13+ returns true; older iOS, non-iOS platforms, or
missing entitlement returns false so AppleSignIn falls back to
its web OIDC flow.signIn
public abstract String signIn(String scopes, String nonce)Parameters
scopesString- Space-separated scope list (e.g.
"name email"). nonceString- SHA-256 hash of the per-request nonce, base64url encoded.
Apple binds this to the returned ID token’s
nonceclaim.
isLoggedIn
public abstract boolean isLoggedIn()true if the user is currently signed in (i.e. the previously
returned credential is still valid in the Apple keychain).signOut
public abstract void signOut()signIn(String, String)
will prompt again.