@capawesome/capacitor-apple-sign-in 0.1.1 â 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -6
- package/android/build.gradle +1 -1
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Capacitor Apple Sign-In Plugin
|
|
2
2
|
|
|
3
3
|
Unofficial Capacitor plugin to sign-in with Apple.[^1]
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ Unofficial Capacitor plugin to sign-in with Apple.[^1]
|
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The Capacitor Apple Sign-In plugin is one of the most complete Apple authentication solutions for Capacitor apps. Here are some of the key features:
|
|
14
14
|
|
|
15
15
|
- ðĨïļ **Cross-platform**: Supports Android, iOS, and Web.
|
|
16
16
|
- ð **Native Sign-In**: Uses native AuthenticationServices on iOS.
|
|
@@ -18,15 +18,20 @@ We are proud to offer one of the most complete and feature-rich Capacitor plugin
|
|
|
18
18
|
- ð§ **Scope support**: Request email and full name on all platforms.
|
|
19
19
|
- ð **Nonce & state**: Supports nonce for replay protection and state for CSRF protection.
|
|
20
20
|
- ðŠķ **Lightweight**: Just a single dependency and zero unnecessary bloat.
|
|
21
|
-
- ðĪ **Compatibility**: Compatible with the [Google Sign-In](https://capawesome.io/docs/
|
|
21
|
+
- ðĪ **Compatibility**: Compatible with the [Google Sign-In](https://capawesome.io/docs/sdks/capacitor/google-sign-in/) and [OAuth](https://capawesome.io/docs/sdks/capacitor/oauth/) plugins.
|
|
22
22
|
- ðĶ **CocoaPods & SPM**: Supports CocoaPods and Swift Package Manager for iOS.
|
|
23
23
|
- ð **Up-to-date**: Always supports the latest Capacitor version.
|
|
24
24
|
|
|
25
25
|
Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Use Cases
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The Apple Sign-In plugin is typically used to let users authenticate with their Apple ID, for example:
|
|
30
|
+
|
|
31
|
+
- **User authentication**: Offer Sign in with Apple as a login option in your app on Android, iOS, and Web.
|
|
32
|
+
- **Account creation**: Request the user's email address and full name during sign-up using the email and full name scopes.
|
|
33
|
+
- **Backend integration**: Send the authorization code and ID token to your backend to verify the sign-in and create a user session.
|
|
34
|
+
- **Secure sign-in flows**: Pass a nonce for replay protection and a state value for CSRF protection.
|
|
30
35
|
|
|
31
36
|
## Compatibility
|
|
32
37
|
|
|
@@ -79,14 +84,28 @@ No configuration required for this plugin.
|
|
|
79
84
|
|
|
80
85
|
## Usage
|
|
81
86
|
|
|
87
|
+
The following examples show how to initialize the plugin and sign in with Apple.
|
|
88
|
+
|
|
89
|
+
### Initialize the plugin
|
|
90
|
+
|
|
91
|
+
On Android and Web, you must initialize the plugin with your Apple Service ID before calling `signIn(...)`. This method is only available on Android and Web:
|
|
92
|
+
|
|
82
93
|
```typescript
|
|
83
|
-
import { AppleSignIn
|
|
94
|
+
import { AppleSignIn } from '@capawesome/capacitor-apple-sign-in';
|
|
84
95
|
|
|
85
96
|
const initialize = async () => {
|
|
86
97
|
await AppleSignIn.initialize({
|
|
87
98
|
clientId: 'com.example.app.signin',
|
|
88
99
|
});
|
|
89
100
|
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Sign in with Apple
|
|
104
|
+
|
|
105
|
+
Start the sign-in flow and receive the authorization code and ID token. Use the `scopes` option to request the user's email address and full name, and pass a `nonce` for replay protection. The `redirectUrl` and `state` options are only available on Android and Web:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { AppleSignIn, SignInScope } from '@capawesome/capacitor-apple-sign-in';
|
|
90
109
|
|
|
91
110
|
const signIn = async () => {
|
|
92
111
|
const result = await AppleSignIn.signIn({
|
|
@@ -228,6 +247,29 @@ This plugin is purpose-built for Apple Sign-In and focuses on providing a clean
|
|
|
228
247
|
- **Scope support**: Request email and full name on all platforms.
|
|
229
248
|
- **Error codes**: Provides typed error codes for proper error handling.
|
|
230
249
|
|
|
250
|
+
### Do I need to call initialize on iOS?
|
|
251
|
+
|
|
252
|
+
No, the `initialize(...)` method is only available on Android and Web, where it must be called before `signIn(...)` to set the Apple Service ID. On iOS, the plugin uses the native AuthenticationServices framework and no initialization is required.
|
|
253
|
+
|
|
254
|
+
### Why are the email and name only returned on the first sign-in on iOS?
|
|
255
|
+
|
|
256
|
+
On iOS, Apple only provides the user's email address, given name, and family name on the first sign-in; on subsequent sign-ins, these values are `null`. Make sure to persist this information, for example on your backend, when you receive it for the first time.
|
|
257
|
+
|
|
258
|
+
### Can I use this plugin with Ionic, React, Vue or Angular?
|
|
259
|
+
|
|
260
|
+
Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.
|
|
261
|
+
|
|
262
|
+
## Related Plugins
|
|
263
|
+
|
|
264
|
+
- [Google Sign-In](https://capawesome.io/docs/sdks/capacitor/google-sign-in/): Sign in with Google.
|
|
265
|
+
- [Facebook Sign-In](https://capawesome.io/docs/sdks/capacitor/facebook-sign-in/): Sign in with Facebook.
|
|
266
|
+
- [OAuth](https://capawesome.io/docs/sdks/capacitor/oauth/): Communicate with OAuth 2.0 and OpenID Connect providers.
|
|
267
|
+
- [Passkeys](https://capawesome.io/docs/sdks/capacitor/passkeys/): Create and authenticate with passkeys based on the WebAuthn standard.
|
|
268
|
+
|
|
269
|
+
## Newsletter
|
|
270
|
+
|
|
271
|
+
Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
|
|
272
|
+
|
|
231
273
|
## Changelog
|
|
232
274
|
|
|
233
275
|
See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/apple-sign-in/CHANGELOG.md).
|
package/android/build.gradle
CHANGED
|
@@ -30,7 +30,7 @@ android {
|
|
|
30
30
|
buildTypes {
|
|
31
31
|
release {
|
|
32
32
|
minifyEnabled false
|
|
33
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
lintOptions {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/capacitor-apple-sign-in",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Capacitor plugin to sign-in with Apple.",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Capacitor plugin to sign-in with Apple on Android, iOS, and Web.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
@@ -36,7 +36,15 @@
|
|
|
36
36
|
"keywords": [
|
|
37
37
|
"capacitor",
|
|
38
38
|
"plugin",
|
|
39
|
-
"native"
|
|
39
|
+
"native",
|
|
40
|
+
"capacitor-plugin",
|
|
41
|
+
"apple sign in",
|
|
42
|
+
"sign in with apple",
|
|
43
|
+
"apple login",
|
|
44
|
+
"apple id",
|
|
45
|
+
"social login",
|
|
46
|
+
"authentication",
|
|
47
|
+
"oauth"
|
|
40
48
|
],
|
|
41
49
|
"scripts": {
|
|
42
50
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|