@logto/connector-github 1.0.0-beta.19 → 1.0.0-beta.21

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 CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  The official Logto connector for GitHub social sign-in.
4
4
 
5
- GitHub 社交登录 Logto 官方连接器 [中文文档](#github-连接器)
6
-
7
5
  **Table of contents**
8
6
 
9
7
  - [Github connector](#github-connector)
@@ -11,19 +9,10 @@ GitHub 社交登录 Logto 官方连接器 [中文文档](#github-连接器)
11
9
  - [Sign in with GitHub account](#sign-in-with-github-account)
12
10
  - [Create and configure OAuth app](#create-and-configure-oauth-app)
13
11
  - [Managing OAuth apps](#managing-oauth-apps)
14
- - [Compose the connector JSON](#compose-the-connector-json)
12
+ - [Configure your connector](#configure-your-connector)
15
13
  - [Config types](#config-types)
16
14
  - [Test GitHub connector](#test-github-connector)
17
15
  - [Reference](#reference)
18
- - [GitHub 连接器](#github-连接器)
19
- - [开始上手](#开始上手)
20
- - [登录 GitHub 账号](#登录-github-账号)
21
- - [创建并配置 OAuth 应用程序](#创建并配置-oauth-应用程序)
22
- - [管理 OAuth 应用程序](#管理-oauth-应用程序)
23
- - [编写连接器的 JSON](#编写连接器的-json)
24
- - [配置类型](#配置类型)
25
- - [测试 GitHub 连接器](#测试-github-连接器)
26
- - [参考](#参考)
27
16
 
28
17
  ## Get started
29
18
 
@@ -49,19 +38,10 @@ We suggest not to check the box before **Enable Device Flow**, or users who sign
49
38
  Go to the [OAuth Apps page](https://github.com/settings/developers) and you can add, edit or delete existing OAuth apps.
50
39
  You can also find `Client ID` and generate `Client secrets` in OAuth app detail pages.
51
40
 
52
- ## Compose the connector JSON
41
+ ## Configure your connector
53
42
 
54
43
  Fill out the `clientId` and `clientSecret` field with _Client ID_ and _Client Secret_ you've got from OAuth app detail pages mentioned in the previous section.
55
44
 
56
- Here is an example of GitHub connector config JSON.
57
-
58
- ```json
59
- {
60
- "clientID": "<your-client-id>",
61
- "clientSecret": "<your-client-secret>"
62
- }
63
- ```
64
-
65
45
  ### Config types
66
46
 
67
47
  | Name | Type |
@@ -78,62 +58,3 @@ That's it. The GitHub connector should be available now. Don't forget to [Enable
78
58
 
79
59
  - [GitHub - Developers - Apps](https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps)
80
60
  - [GitHub - Developers - Apps - Creating an OAuth App](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app)
81
-
82
- # GitHub 连接器
83
-
84
- ## 开始上手
85
-
86
- GitHub 连接器让终端用户可以用 GitHub 账号,通过 GitHub OAuth 2.0 授权协议来登录你的应用。
87
-
88
- ## 登录 GitHub 账号
89
-
90
- 前往 [GitHub 网站](https://github.com/) 并登录你的 GitHub 帐号。
91
-
92
- ## 创建并配置 OAuth 应用程序
93
-
94
- 跟随 [创建 _OAuth 应用程序_](https://docs.github.com/cn/developers/apps/building-oauth-apps/creating-an-oauth-app),注册一个新应用。
95
-
96
- 为新 _OAuth 应用程序_ 取名,并填入「Application name」栏;并填写应用的网页地址「Homepage URL」。
97
- 你需要将 `${your_logto_origin}/callback/${connector_id}` 填写到「Authorization callback URL」栏;「Application description」栏可以选择留白。`connector_id` 在管理控制台相应连接器的详情页的顶栏中可以找到。
98
-
99
- > 注意:如果登录时报错 `The redirect_uri MUST match the registered callback URL for this application.`,可以尝试将 Authorization Callback URL 和 Logto App 的 Redirect URL 保持严格一致(包括协议类型)以解决该问题。
100
-
101
- 我们建议不要勾选「Enable Device Flow」,否则希望在移动设备上登录的用户需要在 GitHub 应用中确认登录的动作。许多 GitHub 用户在移动端设备上不会安装应用,这可能阻碍这些用户的登录流程。
102
-
103
- 如果你的确期望终端用户在移动设备上需要有确认登录的动作,请忽略我们的建议。查看更多关于 [设备流程](https://docs.github.com/cn/developers/apps/building-oauth-apps/authorizing-oauth-apps#device-flow) 的详情。
104
-
105
- ## 管理 OAuth 应用程序
106
-
107
- 前往 [OAuth Apps](https://github.com/settings/developers),你可以添加新应用或者修改、删除已存在的 _OAuth 应用程序_。
108
-
109
- 在应用详情页,你能找到 `Client ID` 和 `Client secrets`(如果没有可以点击「Generate a new client secret」生成新的)。
110
-
111
- ## 编写连接器的 JSON
112
-
113
- 用你从上一步 OAuth 应用程序详情页获取到的 _Client ID_ 和 _Client Secret_ 分别填写 `clientId` 和 `clientSecret`。
114
-
115
- 以下是一个 GitHub 连接器配置 JSON 的样例。
116
-
117
- ```json
118
- {
119
- "clientID": "<your-client-id>",
120
- "clientSecret": "<your-client-secret>"
121
- }
122
- ```
123
-
124
- ### 配置类型
125
-
126
- | 名称 | 类型 |
127
- |--------------|--------|
128
- | clientId | string |
129
- | clientSecret | string |
130
-
131
- ## 测试 GitHub 连接器
132
-
133
- 大功告成!GitHub 连接器现在可以正常使用了。
134
- 别忘了 [在登录体验中启用本连接器](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)。
135
-
136
- ## 参考
137
-
138
- - [GitHub - 开发者 - 应用](https://docs.github.com/cn/developers/apps/getting-started-with-apps/about-apps)
139
- - [GitHub - 开发者 - 应用 - 创建 OAuth 应用程序](https://docs.github.com/cn/developers/apps/building-oauth-apps/creating-an-oauth-app)
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ConnectorPlatform, ConnectorError, ConnectorErrorCodes, ConnectorType, validateConfig, parseJson } from '@logto/connector-kit';
1
+ import { ConnectorPlatform, ConnectorConfigFormItemType, ConnectorError, ConnectorErrorCodes, ConnectorType, validateConfig, parseJson } from '@logto/connector-kit';
2
2
  import { got, HTTPError } from 'got';
3
3
  import { z } from 'zod';
4
4
 
@@ -660,7 +660,22 @@ const defaultMetadata = {
660
660
  ko: 'GitHub는 소프트웨어 개발과 버전 관리를 위한 온라인 커뮤니티입니다.',
661
661
  },
662
662
  readme: './README.md',
663
- configTemplate: './docs/config-template.json',
663
+ formItems: [
664
+ {
665
+ key: 'clientId',
666
+ type: ConnectorConfigFormItemType.Text,
667
+ label: 'Client ID',
668
+ required: true,
669
+ placeholder: '<client-id>',
670
+ },
671
+ {
672
+ key: 'clientSecret',
673
+ type: ConnectorConfigFormItemType.Text,
674
+ label: 'Client Secret',
675
+ required: true,
676
+ placeholder: '<client-secret>',
677
+ },
678
+ ],
664
679
  };
665
680
  const defaultTimeout = 5000;
666
681
 
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "logo-dark.svg"
12
12
  ],
13
13
  "dependencies": {
14
- "@logto/connector-kit": "1.0.0-rc.2",
14
+ "@logto/connector-kit": "1.0.0-rc.3",
15
15
  "@silverhand/essentials": "2.1.0",
16
16
  "got": "^12.5.3",
17
17
  "snakecase-keys": "^5.1.0",
@@ -52,7 +52,7 @@
52
52
  "access": "public"
53
53
  },
54
54
  "name": "@logto/connector-github",
55
- "version": "1.0.0-beta.19",
55
+ "version": "1.0.0-beta.21",
56
56
  "description": "Github web connector implementation.",
57
57
  "author": "Silverhand Inc. <contact@silverhand.io>",
58
58
  "scripts": {
@@ -1,4 +0,0 @@
1
- {
2
- "clientId": "<client-id>",
3
- "clientSecret": "<client-secret>"
4
- }