@logto/connector-apple 1.0.1 → 1.0.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/LICENSE CHANGED
@@ -1,9 +1,3 @@
1
- Portions of this software are licensed as follows:
2
-
3
- * All content that resides under the "packages/cloud" directory of this repository, if that directory exists, is licensed under the license defined in "packages/cloud/LICENSE" (Elastic-2.0).
4
- * All third party components incorporated into this software are licensed under the original license provided by the owner of the applicable component.
5
- * Content outside of the above mentioned directories or restrictions above is available under the "MPL-2.0" license as defined below.
6
-
7
1
  Mozilla Public License Version 2.0
8
2
  ==================================
9
3
 
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  The official Logto connector for Apple social sign-in.
4
4
 
5
- Apple 社交登录 Logto 官方连接器 [中文文档](#apple-连接器)
6
-
7
5
  **Table of contents**
8
6
 
9
7
  - [Apple connector](#apple-connector)
@@ -12,12 +10,6 @@ Apple 社交登录 Logto 官方连接器 [中文文档](#apple-连接器)
12
10
  - [Create an identifier](#create-an-identifier)
13
11
  - [Enable Sign in with Apple for your identifier](#enable-sign-in-with-apple-for-your-identifier)
14
12
  - [Test Apple connector](#test-apple-connector)
15
- - [Apple 连接器](#apple-连接器)
16
- - [开始上手](#开始上手)
17
- - [为你的应用启用「通过 Apple 登录」](#为你的应用启用通过-apple-登录)
18
- - [创建一个 identifier](#创建一个-identifier)
19
- - [为你的 identifier 启用「通过 Apple 登录」](#为你的-identifier-启用通过-apple-登录)
20
- - [测试 Apple 连接器](#测试-apple-连接器)
21
13
 
22
14
  ## Get started
23
15
 
@@ -77,66 +69,4 @@ Click "Next" then "Done" to close the modal. Click "Continue" on the top-right c
77
69
 
78
70
  ## Test Apple connector
79
71
 
80
- That's it. The Apple connector should be available in both web and native apps. Don't forget to [Enable connector in sign-in experience](https://docs.logto.io/docs/tutorials/get-started/enable-social-sign-in#enable-connector-in-sign-in-experience).
81
-
82
- # Apple 连接器
83
-
84
- ## 开始上手
85
-
86
- 如果你还不知道连接器的概念,或者还不知道如何将本连接器添加至你的「登录体验」,请先参见 [Logto 教程](https://docs.logto.io/zh-cn/docs/tutorials/get-started/enable-social-sign-in)。
87
-
88
- > ℹ️ **Note**
89
- >
90
- > 如果你的应用有其他的社交登录方式,AppStore 要求必须同时有 Apple 登录。
91
- > 如果同时提供 Android 应用,在 Android 设备上同时提供 Apple 登录会让用户体验很棒。
92
-
93
- 在继续前,你需要加入 [Apple Developer Program](https://developer.apple.com/programs/)。
94
-
95
- ### 为你的应用启用「通过 Apple 登录」
96
-
97
- > ⚠️ **Caution**
98
- >
99
- > 即使你只想在 web 应用中实现「通过 Apple 登录」,你仍需要拥有一个拥抱 AppStore 生态的应用(即:有一个有效的 App ID)。
100
-
101
- 你可以通过 Xcode -> Project settings -> Signing & Capabilities 来启用,或者访问 [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/list/bundleId)。
102
-
103
- ![Enable Sign in with Apple](/packages/connector-apple/docs/enable-sign-in-with-apple-in-xcode.png)
104
-
105
- 参见 [Apple 官方文档](https://developer.apple.com/documentation/sign_in_with_apple/configuring_your_environment_for_sign_in_with_apple) 里的「Enable an App ID」章节以了解更多。
106
-
107
- ### 创建一个 identifier
108
-
109
- 1. 访问 [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/list/serviceId),并点按在「Identifier」旁边的「+」按钮。
110
- 2. 在「Register a new identifier」页面,选择「Services IDs」并点按「Continue」。
111
- 3. 填写「Description」与「Identifier」(例如 `Logto Test` 和 `io.logto.test`),并点按「Continue」。
112
- 4. 再次检查相关信息并点按「Register」。
113
-
114
- ### 为你的 identifier 启用「通过 Apple 登录」
115
-
116
- 点按你刚刚创建的 identifier。在详情页勾选「Sign in with Apple」并点按「Configure」。
117
-
118
- ![Enable Sign in with Apple](/packages/connector-apple/docs/enable-sign-in-with-apple.png)
119
-
120
- 在打开的对话框中,选择刚刚启用了「通过 Apple 登录」的 App ID。
121
-
122
- 输入你的 Logto 实例域名(不含协议和端口),例如 `your.logto.domain`;并输入「Return URL」(即 Redirect URI)。Return URL 的值是 Logto URL 加上 `/callback/${connector_id}`,例如 `https://your.logto.domain/callback/apple-universal`。在管理控制台创建了 Apple 连接器之后,在详情页可以找到生成的随机 `connector_id`。
123
-
124
- ![domain-and-url](/packages/connector-apple/docs/domain-and-url.png)
125
-
126
- 点按「Next」以及「Done」以关闭对话框。点按右上角的「Continue」,接着点按「Save」以保存你的配置。
127
-
128
- > ⚠️ **Caution**
129
- >
130
- > Apple _不允许_ HTTP 协议或 `localhost` 域名作为 Return URL。
131
- >
132
- > 如果你想在本地进行测试,你需要编辑 `/etc/hosts` 文件以映射 localhost 到一个自定义域名,并设置一个本地的 HTTPS 环境。[mkcert](https://github.com/FiloSottile/mkcert) 可以帮助你设置本地 HTTPS。
133
-
134
- > ℹ️ **Note**
135
- >
136
- > 本连接器暂时不支持自定义 `scope`(例如 name,email)。因为在 `scope` 非空时,Apple 要求 `response_mode` 为 `form_post`,与现在连接器的设计不兼容。
137
- >
138
- > 我们将稍后解决这个问题。
139
-
140
- ## 测试 Apple 连接器
141
-
142
- 大功告成。Apple 连接器应该在 web 和原生应用中都可用了。别忘了 [在登录体验中启用本连接器](https://docs.logto.io/zh-cn/docs/tutorials/get-started/enable-social-sign-in/#%E5%9C%A8%E7%99%BB%E5%BD%95%E4%BD%93%E9%AA%8C%E4%B8%AD%E5%90%AF%E7%94%A8%E8%BF%9E%E6%8E%A5%E5%99%A8)。
72
+ That's it. The Apple connector should be available in both web and native apps. Don't forget to [Enable connector in sign-in experience](https://docs.logto.io/docs/tutorials/get-started/passwordless-sign-in-by-adding-connectors#enable-social-sign-in).
package/lib/index.js CHANGED
@@ -55,8 +55,26 @@ let customAlphabet = (alphabet, size = 21) =>
55
55
 
56
56
  const lowercaseAlphabet = '0123456789abcdefghijklmnopqrstuvwxyz';
57
57
  const alphabet = `${lowercaseAlphabet}ABCDEFGHIJKLMNOPQRSTUVWXYZ`;
58
- const buildIdGenerator = (size, includingUppercase = false) => customAlphabet(includingUppercase ? alphabet : lowercaseAlphabet, size);
59
- const generateStandardId = buildIdGenerator(21);
58
+ const buildIdGenerator = (size, includingUppercase = true) => customAlphabet(includingUppercase ? alphabet : lowercaseAlphabet, size);
59
+ /**
60
+ * Generate a standard id with 21 characters, including lowercase letters and numbers.
61
+ *
62
+ * @see {@link lowercaseAlphabet}
63
+ */
64
+ const generateStandardId = buildIdGenerator(21, false);
65
+ /**
66
+ * Generate a standard short id with 12 characters, including lowercase letters and numbers.
67
+ *
68
+ * @see {@link lowercaseAlphabet}
69
+ */
70
+ buildIdGenerator(12, false);
71
+ /**
72
+ * Generate a standard secret with 32 characters, including uppercase letters, lowercase
73
+ * letters, and numbers.
74
+ *
75
+ * @see {@link alphabet}
76
+ */
77
+ buildIdGenerator(32);
60
78
 
61
79
  const encoder = new TextEncoder();
62
80
  const decoder = new TextDecoder();
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@logto/connector-apple",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Apple web connector implementation.",
5
5
  "dependencies": {
6
6
  "@logto/connector-kit": "^1.1.1",
7
- "@logto/shared": "^2.0.0",
7
+ "@logto/shared": "^3.0.0",
8
8
  "jose": "^4.3.8"
9
9
  },
10
10
  "main": "./lib/index.js",