# Modules.Applesignin

A module to use apple signin functionality.

Availability
1.0.0

# 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:

# Methods

# authorize

Availability
1.0.0
authorize(scopes) 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

# createLoginButton

Availability
1.0.0
createLoginButton([parameters]) Modules.Applesignin.LoginButton

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


# getCredentialState

Availability
1.0.0
getCredentialState(userId, callback) void

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

# Events

# login

Availability
1.0.0

Fired at login.

Properties

Name Type Description
success Boolean

Indicates if the user was logged in successfully. Returns true if request succeeded, false otherwise.

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 success is true.

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

Availability
1.0.0
AUTHORIZATION_SCOPE_EMAIL :Number

A scope that includes the user's email address.


# AUTHORIZATION_SCOPE_FULLNAME

Availability
1.0.0
AUTHORIZATION_SCOPE_FULLNAME :Number

A scope that includes the user's full name.


# BUTTON_STYLE_BLACK

Availability
1.0.0
BUTTON_STYLE_BLACK :Number

Authorization button style black. Use with style.


# BUTTON_STYLE_WHITE

Availability
1.0.0
BUTTON_STYLE_WHITE :Number

Authorization button style white. Use with style.


# BUTTON_STYLE_WHITE_OUTLINE

Availability
1.0.0
BUTTON_STYLE_WHITE_OUTLINE :Number

Authorization button style white outline. Use with style.


# BUTTON_TYPE_CONTINUE

Availability
1.0.0
BUTTON_TYPE_CONTINUE :Number

Continue authorization button type. Use with type.


# BUTTON_TYPE_DEFAULT

Availability
1.0.0
BUTTON_TYPE_DEFAULT :Number

Default authorization button type. Use with type.


# BUTTON_TYPE_SIGN_IN

Availability
1.0.0
BUTTON_TYPE_SIGN_IN :Number

Signin authorization button type. Use with type.


# CREDENTIAL_STATE_AUTHORIZED

Availability
1.0.0
CREDENTIAL_STATE_AUTHORIZED :Number

The user is authorized.


# CREDENTIAL_STATE_NOT_FOUNFD

Availability
1.0.0
CREDENTIAL_STATE_NOT_FOUNFD :Number

The user can't be found.


# CREDENTIAL_STATE_REVOKED

Availability
1.0.0
CREDENTIAL_STATE_REVOKED :Number

Authorization for the given user has been revoked.


# USER_DETECTION_STATUS_REAL

Availability
1.0.0
USER_DETECTION_STATUS_REAL :Number

The user appears to be a real person.


# USER_DETECTION_STATUS_UNKNOWN

Availability
1.0.0
USER_DETECTION_STATUS_UNKNOWN :Number

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


# USER_DETECTION_STATUS_UNSUPPORTED

Availability
1.0.0
USER_DETECTION_STATUS_UNSUPPORTED :Number

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