@logto/connector-github 1.0.0-beta.10

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Silverhand
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # Github connector
2
+
3
+ The official Logto connector for GitHub social sign-in.
4
+
5
+ GitHub 社交登录 Logto 官方连接器 [中文文档](#github-连接器)
6
+
7
+ **Table of contents**
8
+
9
+ - [Github connector](#github-connector)
10
+ - [Get started](#get-started)
11
+ - [Sign in with GitHub account](#sign-in-with-github-account)
12
+ - [Create and configure OAuth app](#create-and-configure-oauth-app)
13
+ - [Managing OAuth apps](#managing-oauth-apps)
14
+ - [Compose the connector JSON](#compose-the-connector-json)
15
+ - [Config types](#config-types)
16
+ - [Test GitHub connector](#test-github-connector)
17
+ - [Reference](#reference)
18
+ - [GitHub 连接器](#github-连接器)
19
+ - [开始上手](#开始上手)
20
+ - [登录 GitHub 账号](#登录-github-账号)
21
+ - [创建并配置 OAuth 应用程序](#创建并配置-oauth-应用程序)
22
+ - [管理 OAuth 应用程序](#管理-oauth-应用程序)
23
+ - [编写连接器的 JSON](#编写连接器的-json)
24
+ - [配置类型](#配置类型)
25
+ - [测试 GitHub 连接器](#测试-github-连接器)
26
+ - [参考](#参考)
27
+
28
+ ## Get started
29
+
30
+ The GitHub connector enables end-users to sign in to your application using their own GitHub accounts via GitHub OAuth 2.0 authentication protocol.
31
+
32
+ ## Sign in with GitHub account
33
+
34
+ Go to the [GitHub website](https://github.com/) and sign in with your GitHub account. You may register a new account if you don't have one.
35
+
36
+ ## Create and configure OAuth app
37
+
38
+ Follow the [creating an OAuth App](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app) guide, and register a new application.
39
+
40
+ Name your new OAuth application in **Application name** and fill up **Homepage URL** of the app.
41
+ You can leave **Application description** field blank and customize **Authorization callback URL** as `${your_logto_origin}/callback/github-universal`.
42
+
43
+ We suggest not to check the box before **Enable Device Flow**, or users who sign in with GitHub on mobile devices must confirm the initial sign-in action in the GitHub app. Many GitHub users do not install the GitHub mobile app on their phones, which could block the sign-in flow. Please ignore our suggestion if you are expecting end-users to confirm their sign-in flow. See details of [device flow](https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#device-flow).
44
+
45
+ ## Managing OAuth apps
46
+
47
+ Go to the [OAuth Apps page](https://github.com/settings/developers) and you can add, edit or delete existing OAuth apps.
48
+ You can also find `Client ID` and generate `Client secrets` in OAuth app detail pages.
49
+
50
+ ## Compose the connector JSON
51
+
52
+ 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.
53
+
54
+ Here is an example of GitHub connector config JSON.
55
+
56
+ ```json
57
+ {
58
+ "clientID": "<your-client-id>",
59
+ "clientSecret": "<your-client-secret>"
60
+ }
61
+ ```
62
+
63
+ ### Config types
64
+
65
+ | Name | Type |
66
+ |--------------|--------|
67
+ | clientId | string |
68
+ | clientSecret | string |
69
+
70
+
71
+ ## Test GitHub connector
72
+
73
+ That's it. The GitHub connector should be available now. 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).
74
+
75
+ ## Reference
76
+
77
+ - [GitHub - Developers - Apps](https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps)
78
+ - [GitHub - Developers - Apps - Creating an OAuth App](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app)
79
+
80
+ # GitHub 连接器
81
+
82
+ ## 开始上手
83
+
84
+ GitHub 连接器让终端用户可以用 GitHub 账号,通过 GitHub OAuth 2.0 授权协议来登录你的应用。
85
+
86
+ ## 登录 GitHub 账号
87
+
88
+ 前往 [GitHub 网站](https://github.com/) 并登录你的 GitHub 帐号。
89
+
90
+ ## 创建并配置 OAuth 应用程序
91
+
92
+ 跟随 [创建 _OAuth 应用程序_](https://docs.github.com/cn/developers/apps/building-oauth-apps/creating-an-oauth-app),注册一个新应用。
93
+
94
+ 为新 _OAuth 应用程序_ 取名,并填入「Application name」栏;并填写应用的网页地址「Homepage URL」。
95
+ 你需要将 `${your_logto_origin}/callback/github-universal` 填写到「Authorization callback URL」栏;「Application description」栏可以选择留白。
96
+
97
+ 我们建议不要勾选「Enable Device Flow」,否则希望在移动设备上登录的用户需要在 GitHub 应用中确认登录的动作。许多 GitHub 用户在移动端设备上不会安装应用,这可能阻碍这些用户的登录流程。
98
+
99
+ 如果你的确期望终端用户在移动设备上需要有确认登录的动作,请忽略我们的建议。查看更多关于 [设备流程](https://docs.github.com/cn/developers/apps/building-oauth-apps/authorizing-oauth-apps#device-flow) 的详情。
100
+
101
+ ## 管理 OAuth 应用程序
102
+
103
+ 前往 [OAuth Apps](https://github.com/settings/developers),你可以添加新应用或者修改、删除已存在的 _OAuth 应用程序_。
104
+
105
+ 在应用详情页,你能找到 `Client ID` 和 `Client secrets`(如果没有可以点击「Generate a new client secret」生成新的)。
106
+
107
+ ## 编写连接器的 JSON
108
+
109
+ 用你从上一步 OAuth 应用程序详情页获取到的 _Client ID_ 和 _Client Secret_ 分别填写 `clientId` 和 `clientSecret`。
110
+
111
+ 以下是一个 GitHub 连接器配置 JSON 的样例。
112
+
113
+ ```json
114
+ {
115
+ "clientID": "<your-client-id>",
116
+ "clientSecret": "<your-client-secret>"
117
+ }
118
+ ```
119
+
120
+ ### 配置类型
121
+
122
+ | 名称 | 类型 |
123
+ |--------------|--------|
124
+ | clientId | string |
125
+ | clientSecret | string |
126
+
127
+ ## 测试 GitHub 连接器
128
+
129
+ 大功告成!GitHub 连接器现在可以正常使用了。
130
+ 别忘了 [在登录体验中启用本连接器](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)。
131
+
132
+ ## 参考
133
+
134
+ - [GitHub - 开发者 - 应用](https://docs.github.com/cn/developers/apps/getting-started-with-apps/about-apps)
135
+ - [GitHub - 开发者 - 应用 - 创建 OAuth 应用程序](https://docs.github.com/cn/developers/apps/building-oauth-apps/creating-an-oauth-app)
@@ -0,0 +1,4 @@
1
+ {
2
+ "clientId": "<client-id>",
3
+ "clientSecret": "<client-secret>"
4
+ }