Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class AppleClientSecret
- Object
- AppleClientSecret
ImplementsClientRegistration.ClientSecretSupplier
The client secret of Sign in with Apple, which is not a text Apple issues
but a token this server signs: an ES256 JWT naming the team, the client and
Apple, signed with the .p8 key downloaded from the developer account.
CommonOAuth2Provider.APPLE.getBuilder("apple")
.clientId("com.example.web") // the Services ID
.clientSecretSupplier(AppleClientSecret.fromFile(teamId, keyId, "AuthKey.p8"))
.build();
A secret is good for an hour and is made again when it has under five minutes left, so signing costs one signature an hour and not one a sign-in.
Fields
public static final String AUDIENCE = "https://appleid.apple.com" | Who the token is for. |
Constructors
public AppleClientSecret(String teamId, String keyId, String privateKeyPem)
throws IOException |
Methods
Inherited methods
Field details
AUDIENCE
public static final String AUDIENCE = "https://appleid.apple.com"Who the token is for.
Constructor details
AppleClientSecret
public AppleClientSecret(String teamId, String keyId, String privateKeyPem)
throws IOExceptionParameters
teamIdString- the ten-character Team ID of the developer account
keyIdString- the Key ID of the Sign in with Apple key
privateKeyPemString- the text of the
.p8file
Throws
Method details
fromFile
public static AppleClientSecret fromFile(String teamId, String keyId, String path)
throws IOExceptionAppleClientSecret(String, String, String) reading the key from a file.Throws
setClock
public synchronized void setClock(Clock clock)The clock the secret’s times are read from; for tests.
getClientSecret
public synchronized String getClientSecret(ClientRegistration registration)The secret to send now.