https://github.com/tidev/titanium-apple-sign-in
Use the iOS 13+ Apple Sign In API with Titanium
https://github.com/tidev/titanium-apple-sign-in
appcelerator apple-sign-in ios13 titanium titanium-module
Last synced: about 1 year ago
JSON representation
Use the iOS 13+ Apple Sign In API with Titanium
- Host: GitHub
- URL: https://github.com/tidev/titanium-apple-sign-in
- Owner: tidev
- License: mit
- Created: 2019-06-06T04:08:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-22T21:21:42.000Z (over 3 years ago)
- Last Synced: 2025-04-24T05:09:18.490Z (about 1 year ago)
- Topics: appcelerator, apple-sign-in, ios13, titanium, titanium-module
- Language: Swift
- Homepage:
- Size: 3.15 MB
- Stars: 29
- Watchers: 12
- Forks: 11
- Open Issues: 34
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# iOS 13+ Apple Sign In in Titanium [](https://jenkins.appcelerator.org/job/modules/job/titanium-apple-sign-in/job/master/) [](https://www.npmjs.com/package/@titanium-sdk/ti.applesignin)
Full support for iOS 13+ Apple Sign In with Titanium.
## Requirements
The following project- and OS-requirements are necessary:
- [x] Xcode 11+
- [x] iOS 13+
- [x] Titanium SDK 8.0.0+
## Example
This module was designed to follow a similar scheme like Ti.Facebook and Ti.GoogleSignIn.
```js
var AppleSignIn = require('ti.applesignin');
AppleSignIn.addEventListener('login', function (event) {
if (!event.success) {
alert(event.error);
return;
}
Ti.API.warn(event);
});
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
win.addEventListener('open', () => {
AppleSignIn.checkExistingAccounts();
});
var btn = AppleSignIn.createLoginButton({ width: 280, height: 38 });
btn.addEventListener('click', function () {
AppleSignIn.authorize();
});
win.add(btn);
win.open();
```
## API's
### Methods
#### `checkExistingAccounts()`
Checks for existing accounts (if available)
#### `createLoginButton()`
Creates a new localized login button.
#### `authorize({ scopes })`
Starts an authorization flow with an optional array of scoped. Defaults to all scopes (`fullName` and `email`).
#### `getCredentialState(userId, callback)`
Fetches the current credential state with a given user-id (received from the `event.profile.userId` key of the `login` event).
The result is returned to the `state` parameter of the `callback` and can be authorized, revoked, transferred or unknown.
### Events
#### `login`
The login event with the user's `profile`.
## Installation
- [x] Add the following entitlements to your project:
```xml
com.apple.developer.applesignin
Default
```
- [x] Make sure your server is eligible to send mails to the Apple Sign In provider service.
## License
MIT
## Author
Hans Knöchel