siwa

Version: stable

FUNCTION
siwa.is_supported()
siwa.get_credential_state()
siwa.authenticate()
CONSTANT
STATE_NOT_FOUND
STATE_UNKNOWN
STATE_AUTHORIZED
STATE_REVOKED
STATUS_UNKNOWN
STATUS_UNSUPPORTED
STATUS_LIKELY_REAL

Functions

siwa.is_supported()

siwa.is_supported()

Check if Sign in with Apple is available (iOS 13+).

PARAMETERS

None


siwa.get_credential_state()

siwa.get_credential_state(user_id,callback)

Get the credential state of a user.

PARAMETERS

user_id string User id to get credential state for.
callback function Credential state callback function.
self object The current object.
state table The credential state (user_id, credential_state)

EXAMPLES

siwa.get_credential_state(id, function(self, data)
    if data.credential_state == siwa.STATE_AUTHORIZED then
        print("User has still authorized the application", data.user_id)
    elseif data.credential_state == siwa.STATE_REVOKED then
        print("User has revoked authorization for the application", data.user_id)
    end
end)

siwa.authenticate()

siwa.authenticate(callback)

Show the Sign in with Apple UI

PARAMETERS

callback function Authentication callback function.
self object The current object.
state table The authentication result data (user_id, identity_token, email, first_name, family_name, status, result)

EXAMPLES

siwa.authenticate(function(self, data)
    print(data.identity_token)
    print(data.user_id)
    print(data.first_name, data.family_name)
    print(data.email)
    if data.user_status == siwa.STATUS_LIKELY_REAL then
        print("Likely a real person")
    end
end)

Constants

STATE_NOT_FOUND

The user can’t be found.


STATE_UNKNOWN

Unknown credential state.


STATE_AUTHORIZED

The user is authorized.


STATE_REVOKED

Authorization for the given user has been revoked.


STATUS_UNKNOWN

The system hasn’t determined whether the user might be a real person.


STATUS_UNSUPPORTED

The system can’t determine this user’s status as a real person.


STATUS_LIKELY_REAL

The user appears to be a real person.