All Projects → EddyVerbruggen → nativescript-apple-sign-in

EddyVerbruggen / nativescript-apple-sign-in

Licence: Apache-2.0 license
Sign In With Apple, as seen on WWDC 2019, available with iOS 13

Programming Languages

typescript
32286 projects
shell
77523 projects

Projects that are alternatives of or similar to nativescript-apple-sign-in

nativescript-store-update
No description or website provided.
Stars: ✭ 18 (-51.35%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-menu
A plugin that adds a pop-up menu to NativeScript
Stars: ✭ 17 (-54.05%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-app-shortcuts
👇 Home Icon Actions for your NativeScript app, now also for Android!
Stars: ✭ 45 (+21.62%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-image-filters
NativeScript plugin to apply filters to images
Stars: ✭ 30 (-18.92%)
Mutual labels:  nativescript, nativescript-plugin
texttospeech
Text to Speech NativeScript plugin for Android & iOS 📢
Stars: ✭ 44 (+18.92%)
Mutual labels:  nativescript, nativescript-plugin
insomnia
😪 NativeScript plugin to keep the device awake (not dim the screen, lock, etc)
Stars: ✭ 40 (+8.11%)
Mutual labels:  nativescript, nativescript-plugin
ui
Add right-to-left support to the NativeScript framework
Stars: ✭ 22 (-40.54%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-clipboard
📋 NativeScript plugin to copy stuff to the device clipboard, and read from it again
Stars: ✭ 40 (+8.11%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-printer
📠 Send an image or the screen contents to a physical printer
Stars: ✭ 33 (-10.81%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-performance-monitor
⚡ Proof your app maintains 60-ish FPS by collecting data or showing it on screen with this NativeScript plugin!
Stars: ✭ 21 (-43.24%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-appversion
🔢 NativeScript plugin to retrieve your app's package ID and current version
Stars: ✭ 47 (+27.03%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-homekit
🏡 HomeKit plugin for your fancy NativeScript app
Stars: ✭ 23 (-37.84%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-drawingpad
📝 NativeScript plugin to provide a way to capture any drawing (signatures are a common use case) from the device
Stars: ✭ 89 (+140.54%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-ng-shadow
Angular directive to apply shadows to native elements according to the elevation level guidelines of material design specification
Stars: ✭ 54 (+45.95%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-star-printer
🌟 Print directly to Star Micronics printers from your NativeScript app! http://www.starmicronics.com/
Stars: ✭ 28 (-24.32%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-fabric
Handling App URLs in nativescript apps
Stars: ✭ 29 (-21.62%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-taptic-engine
📳 Use Apple's Taptic Engine to vibrate your iPhone 6s (and up) in a variety of ways
Stars: ✭ 16 (-56.76%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-vue-examples
🍈 NativeScript and Vue code samples.
Stars: ✭ 13 (-64.86%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (-13.51%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-vue-multi-drawer
A NativeScript-Vue component for creating multiple side drawers (4 sides supported)
Stars: ✭ 45 (+21.62%)
Mutual labels:  nativescript, nativescript-plugin

Sign In with Apple, for NativeScript

NPM version Downloads Twitter Follow

Plugin version 2+ is compatible with NativeScript 7+. If you use an older NativeScript version, please use plugin version 1.1.0.

Requirements

  • Go to the Apple developer website and create a new app identifier with the "Sign In with Apple" Capability enabled. Make sure you sign your app with a provisioning profile using that app identifier.
  • Open your app's App_Resources/iOS folder and add this (or append) to a file named app.entitlements.

Installation

tns plugin add nativescript-apple-sign-in

Demo app

If you're stuck or want a quick demo of how this works, check out the demo app:

git clone https://github.com/EddyVerbruggen/nativescript-apple-sign-in
cd nativescript-apple-sign-in/src
npm run demo.ios

API

isSignInWithAppleSupported

Sign In with Apple was added in iOS 13, so make sure to call this function before showing a "Sign In with Apple" button in your app. On iOS < 13 and Android this will return false.

import { isSignInWithAppleSupported } from "nativescript-apple-sign-in";

const supported: boolean = isSignInWithAppleSupported();

signInWithApple

Now that you know "Sign In with Apple" is supported on this device, you can have the user sign themself in (after they pressed a nice button for instance).

import { signInWithApple, SignInWithAppleAuthorization } from "nativescript-apple-sign-in";

signInWithApple(
    {
        // by default you don't get these details, but if you provide these scopes you will (and the user will get to choose which ones are allowed)
        scopes: ["EMAIL", "FULLNAME"]
    })
    .then((result: SignInWithAppleAuthorization) => {
        console.log("Signed in, credential: " + result.credential);
        console.log("Signed in, familyName: " + result.credential.fullName.familyName);
        // you can remember the user to check the sign in state later (see 'getSignInWithAppleState' below)
        this.user = result.credential.user;
    })
    .catch(err => console.log("Error signing in: " + err));

getSignInWithAppleState

⚠️ This does not seem to work on a simulator!

If you want to know the current Sign In status of your user, you can pass the user (id) you acquired previously.

import { getSignInWithAppleState } from "nativescript-apple-sign-in";

const user: string = "the id you got back from the signInWithApple function";

getSignInWithAppleState(user)
    .then(state => console.log("Sign in state: " + state))
    .catch(err => console.log("Error getting sign in state: " + err));
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].