Skip to content

pscsrv/cordova-plugin-apple-login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-apple-login

Install

npm i cordova-plugin-apple-login

Usage

SignInWithApple.isAvailable()

Returns true if Sign in with Apple is available.

Sample:

SignInWithApple.isAvailable().then(function (isAvailable) {
  console.info(isAvailable)
})

SignInWithApple.request(options)

Request authentication for Apple ID.

Options:

{
  requestedScopes: [ SignInWithApple.Scope.Email ],
  requestedOperation: SignInWithApple.Operation.Login,
  user: 'userId',
  state: 'state',
  nonce: 'nonce'
}

Returns:

{
  authorizedScopes: [],
  identityToken: 'identityToken',
  authorizationCode: 'authorizationCode',
  realUserStatus: 1,
  fullName: {
    namePrefix: null,
    givenName: null,
    nameSuffix: null,
    middleName: null,
    familyName: null,
    nickname: null
  },
  email: null,
  state: null,
  user: 'userId'
}

see: https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidcredential

Sample:

SignInWithApple.request({
  requestedScopes: [ SignInWithApple.Scope.Email, SignInWithApple.Scope.FullName ],  
}).then(function (credential) {
  console.info(credential)
})

SignInWithApple.getCredentialState(options)

Returns the user credential status.

Options:

{
  userId: 'userId'
}

Returns:

see: https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidprovider/credentialstate

Sample:

SignInWithApple.getCredentialState({
  userId: 'userId',  
}).then(function (credentialState) {
  console.info(credentialState)
})