SigninWithApple Events
SigninWithApple has the following events associated with it:

An event callback is invoked by the platform when the user performs a sucsessfull authentication action using the Apple ID on the SigninWithApple widget button.
- Once the user logs in with the Apple ID, we'll get a set of values that will help to store in the keychain.
Values collected | Description |
---|---|
User | Unique user-id |
givenName | Name of user |
familyName | User family Name |
identityToken | The JSON Web Token (JWT) served to securely communicate user identity information to the app. The ID token, signed by Apple's ID provider, includes the following information: Issuer Identifier, Subject Identifier, Audience, Expiry Time and Issuance Time. Example: Email which is used for sign in |
The email used for sign in. | |
authorizationCode | A short-lived, one-time valid token that provides proof of authorization for the server component of the app. The authorization code is connected to the specific transaction using the state attribute passed in the request for authorization. The application's server component will validate the code using the Apple identity service endpoint provided for this purpose. |
authorizedScopes | This value will include a list of scopes for which authorization has been provided by the user. These could contain a subset of the scopes requested on @see ASAuthorizationAppleIDRequest. This value should be queried by the application to identify which scopes have been returned as it may differ from those requested. |
Syntax
onSuccessCallback ()
Type
Constant
Read/Write
Read Only
Example
//Sample code to call a onSuccessCallback event for the SigninWithApple widget
var Button0f4d67ccf258c4b = new kony.ui.SignInWithApple({ "authorizationButtonType": kony.signinwithapple.BUTTON_TYPE_CONTINUE, "authorizationButtonStyle":kony.signinwithapple.BUTTON_STYLE_BLACK, "authorizationButtonCornerRadius" : 20.0, "onSuccessCallback": callback1, "onFailureCallback":callback2 }, { "contentAlignment": constants.CONTENT_ALIGN_CENTER, "displayText": true }, { }); function callback1(result) { alert("result :"+ JSON.stringify(result)); alert("name :"+ (result.givenName)); alert("email :"+ (result.email)); alert("iden :"+ (result.identityToken)); alert("authcode :"+ (result.authorizationCode)); } function callback2(errorMsg, errorCode) { alert("errorMsg :"+ errorMsg); alert("errorCode :"+ errorCode); } var mySignIn = new kony.ui.SignInWithApple({ "authorizationButtonType": kony.signinwithapple.BUTTON_TYPE_CONTINUE, "authorizationButtonStyle": kony.signinwithapple.BUTTON_STYLE_BLACK, "authorizationButtonCornerRadius": 20.0, "onSuccessCallback": mySuccessCallback, "onFailureCallback": myFailureCallback }, { "contentAlignment": constants.CONTENT_ALIGN_CENTER, "displayText": true }, { }); function mySuccessCallback(result) { alert("result :" + JSON.stringify(result)); alert("name :" + (result.givenName)); alert("email :" + (result.email)); alert("iden :" + (result.identityToken)); alert("authcode :" + (result.authorizationCode)); } function myFailureCallback(errorMsg, errorCode) { alert("errorMsg :" + errorMsg); alert("errorCode :" + errorCode); }
Platform Availability
- iOS 13 or later

An event onFailureCallback is invoked by the platform when the user fails a authentication action using the Apple ID on the SigninWithApple widget button.
The following table lists the Error codes that are displayed on the Quantum Visualizer.
Error Codes | Failure Callback with enum Values | Description |
---|---|---|
1000 | KonySignInWithAppleAuthorizationErrorUnknown | The authorization attempt failed for an unknown reason. |
1001 | KonySignInWithAppleAuthorizationErrorCanceled | The user canceled the authorization attempt. |
1002 | KonySignInWithAppleAuthorizationErrorInvalidResponse | The authorization request received an invalid response. |
1003 | KonySignInWithAppleAuthorizationErrorNotHandled | The authorization request wasn’t handled. |
1004 | KonySignInWithAppleAuthorizationErrorFailed | The authorization attempt failed. |
Syntax
onFailureCallback
Type
Constant
Read/Write
Read only- (Constructor level)
Example
//Sample code to call a onFailureCallback property for the SigninWithApple widget var mySignIn = new kony.ui.SignInWithApple({ "authorizationButtonType": kony.signinwithapple.BUTTON_TYPE_CONTINUE, "authorizationButtonStyle":kony.signinwithapple.BUTTON_STYLE_BLACK, "authorizationButtonCornerRadius" : 20.0, "onSuccessCallback": callback1, "onFailureCallback":callback2 }, { "contentAlignment": constants.CONTENT_ALIGN_CENTER, "displayText": true }, { }); function callback1(result) { alert("result :"+ JSON.stringify(result)); alert("name :"+ (result.givenName)); alert("email :"+ (result.email)); alert("iden :"+ (result.identityToken)); alert("authcode :"+ (result.authorizationCode)); } function callback2(errorMsg, errorCode) { alert("errorMsg :"+ errorMsg); alert("errorCode :"+ errorCode); }
Platform Availability
- iOS 13 or later.