# Modules.Applesignin
A module to use apple signin functionality.
# Overview
# Apple sign in Resources
# Requirements
- iOS 13 and later
# Getting Started
# Configure iOS: Capabilities and Provisioning Profiles
Required capabilities:
<key>com.apple.developer.applesignin</key> <array> <string>Default</string> </array>
Provisioning Profile entitled with 'Sign In with Apple' capability
# Accessing the Module
Use
require
to access this module from JavaScript:var AppleSignin = require('ti.applesignin');
The
AppleSignin
variable is a reference to the Module object.
# Example applications
- Example applications are located in the
example/ios
folder of the module:
# Properties
# apiName READONLY
The name of the API that this proxy corresponds to.
The value of this property is the fully qualified name of the API. For example, Titanium.UI.Button
returns Ti.UI.Button
.
# bubbleParent
Indicates if the proxy will bubble an event to its parent.
Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.
Default: true
# Methods
# addEventListener
Adds the specified callback as an event listener for the named event.
Parameters
Name | Type | Description |
---|---|---|
name | String | Name of the event. |
callback | Callback<Titanium.Event> | Callback function to invoke when the event is fired. |
Returns
- Type
- void
# applyProperties
Applies the properties to the proxy.
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.
Parameters
Name | Type | Description |
---|---|---|
props | Dictionary | A dictionary of properties to apply. |
Returns
- Type
- void
Request Apple ID authorization.
After authorizarion it will fire event login event which tells success or failure of login.
Parameters
Name | Type | Description |
---|---|---|
scopes | Array<Number> | The contact information to be requested from the user during authentication. Use the Modules.Applesignin.AUTHORIZATION_SCOPE_* constant values to populate the array. |
Returns
- Type
- void
Creates and returns an instance of Modules.Applesignin.LoginButton.
Parameters
Name | Type | Description |
---|---|---|
parameters | Dictionary<Modules.Applesignin.LoginButton> | Properties to set on a new object, including any defined by Modules.Applesignin.LoginButton except those marked not-creation or read-only. |
Returns
# fireEvent
Fires a synthesized event to any registered listeners.
Parameters
Name | Type | Description |
---|---|---|
name | String | Name of the event. |
event | Dictionary | A dictionary of keys and values to add to the Titanium.Event object sent to the listeners. |
Returns
- Type
- void
# getCredentialState
Returns the credential state for the given user.
This method returns immediately without waiting for tasks to finish. Once a session is invalidated,
new tasks cannot be created in the session, but existing tasks continue until completion. Once
invalidated, references to the events and callback objects are broken. Session objects cannot be
reused. To cancel all outstanding tasks, call invalidateAndCancel
instead.
Parameters
Name | Type | Description |
---|---|---|
userId | String | A string, <Modules.Applesignin.ProfileObject.userId>, associated with the Apple ID that your app receives in login event. |
callback | Callback<CredentialStateResponse> | Function to invoke on success or failure. |
Returns
- Type
- void
# removeEventListener
Removes the specified callback as an event listener for the named event.
Multiple listeners can be registered for the same event, so the
callback
parameter is used to determine which listener to remove.
When adding a listener, you must save a reference to the callback function in order to remove the listener later:
var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);
To remove the listener, pass in a reference to the callback function:
window.removeEventListener('click', listener);
Parameters
Name | Type | Description |
---|---|---|
name | String | Name of the event. |
callback | Callback<Titanium.Event> | Callback function to remove. Must be the same function passed to |
Returns
- Type
- void
# Events
# login
Fired at login.
Properties
Name | Type | Description |
---|---|---|
success | Boolean | Indicates if the user was logged in successfully.
Returns |
cancelled | Boolean | Indicates if the user cancelled the login request by closing the dialog. |
error | String | Error message, if any returned. Will be undefined if |
profile | ProfileObject | User profile returned after successful login. |
source | Object | Source object that fired the event. |
type | String | Name of the event fired. |
bubbles | Boolean | True if the event will try to bubble up if possible. |
cancelBubble | Boolean | Set to true to stop the event from bubbling. |
# Constants
# AUTHORIZATION_SCOPE_EMAIL
A scope that includes the user's email address.
# AUTHORIZATION_SCOPE_FULLNAME
A scope that includes the user's full name.
# BUTTON_STYLE_WHITE_OUTLINE
Authorization button style white outline. Use with style.
# BUTTON_TYPE_CONTINUE
Continue authorization button type. Use with type.
# CREDENTIAL_STATE_REVOKED
Authorization for the given user has been revoked.
# USER_DETECTION_STATUS_REAL
The user appears to be a real person.
# USER_DETECTION_STATUS_UNKNOWN
The system hasn't determined whether the user might be a real person.
# USER_DETECTION_STATUS_UNSUPPORTED
The system can't determine this user's status as a real person.