@logto/connector-google 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 Google connector provides a succinct way for your application to use Google’s OAuth 2.0 authentication system.
4
4
 
5
- Google 连接器为你的应用程序提供了一种接入 Google OAuth 2.0 身份验证系统的简单方式。
6
-
7
5
  **Table of contents**
8
6
  - [Google connector](#google-connector)
9
7
  - [Set up a project in the Google API Console](#set-up-a-project-in-the-google-api-console)
@@ -16,17 +14,6 @@ Google 连接器为你的应用程序提供了一种接入 Google OAuth 2.0 身
16
14
  - [Obtain OAuth 2.0 credentials](#obtain-oauth-20-credentials)
17
15
  - [Config types](#config-types)
18
16
  - [References](#references)
19
- - [Google 连接器](#google-连接器)
20
- - [在 Google API 控制台中创建一个项目](#在-google-api-控制台中创建一个项目)
21
- - [配置 OAuth 同意屏幕](#配置-oauth-同意屏幕)
22
- - [注册和配置应用](#注册和配置应用)
23
- - [修改应用注册](#修改应用注册)
24
- - [设置「OAuth 同意屏幕」](#设置oauth-同意屏幕)
25
- - [配置权限「范围」](#配置权限范围)
26
- - [添加「测试用户」(仅「User Type」(用户类型)设置为「外部」时需要)](#添加测试用户仅user-type用户类型设置为外部时需要)
27
- - [获取 OAuth 2.0 凭据](#获取-oauth-20-凭据)
28
- - [配置类型](#配置类型)
29
- - [参考](#参考)
30
17
 
31
18
  ## Set up a project in the Google API Console
32
19
 
@@ -82,59 +69,3 @@ Now you should have the Google OAuth 2.0 consent screen configured.
82
69
 
83
70
  ## References
84
71
  * [Google Identity: Setting up OAuth 2.0](https://developers.google.com/identity/protocols/oauth2/openid-connect#appsetup)
85
-
86
- # Google 连接器
87
-
88
- ## 在 Google API 控制台中创建一个项目
89
-
90
- - 用你的 Google 帐号登录 [Google 云端平台](https://console.developers.google.com)。
91
- - 点按顶部菜单栏上的「选择项目」,然后点击「新建项目」按钮,新建一个项目。
92
- - 在新创建的项目中,点击「API 和服务」进入「API 和服务」的页面中。
93
-
94
- ## 配置 OAuth 同意屏幕
95
-
96
- ### 注册和配置应用
97
-
98
- - 在左侧的「API 和服务」的菜单栏中, 点按「OAuth 同意屏幕」。
99
- - 选择你所需要的「User Type」(用户类型),之后点击「创建」。(注意: 如果你将「User Type」(用户类型)设置为「外部」,在后续的步骤中你需要设置测试用户。)
100
-
101
- 现在你将位于「修改应用注册」页面。
102
-
103
- ### 修改应用注册
104
-
105
- #### 设置「OAuth 同意屏幕」
106
-
107
- - 根据页面提示,填写「OAuth 同意屏幕」相关表单。
108
- - 点按「保存并继续」以进行后续操作。
109
-
110
- #### 配置权限「范围」
111
-
112
- - 点击「添加或移除范围」按钮,然后在弹出的抽屉页面中选择 `../auth/userinfo.email`、 `../auth/userinfo.profile` 和 `openid`,然后点击「更新」以完成配置。
113
- - 根据你的需求填写页面上的相关的表单。
114
- - 点按「保存并继续」以进行后续操作。
115
-
116
- #### 添加「测试用户」(仅「User Type」(用户类型)设置为「外部」时需要)
117
-
118
- - 点击 「+ ADD USERS」(添加用户)添加测试用户,以便这些用户能在应用的发布状态为”测试时“能访问该应用。
119
- - 点按「保存并继续」以进行后续操作。
120
-
121
- 现在你已经配置好了 Google 的「OAuth 同意屏幕」。
122
-
123
- ## 获取 OAuth 2.0 凭据
124
-
125
- - 在左侧「API 和服务」的菜单中,点按「凭据」选项。
126
- - 在「凭据」页面内的上部菜单栏中,点击「+ 创建凭据」,然后选择「OAuth 客户端 ID」。
127
- - 在「创建 OAuth 客户端 ID」页面内,将「应用类型」设置为「Web 应用」。
128
- - 填写相关的应用基本信息。
129
- - 在「已获授权的 JavaScript 来源」中,点击「+ 添加URI」,该 URI 值为你所部署的 Logto 服务的地址。此处这个值应为 `${your_logto_origin}`。例如:`https://logto.dev`。
130
- - 在「已获授权的重定向 URI」中,点击「+ 添加URI」以添加「已获授权的重定向 URI」。「已获授权的重定向 URI」将在用户使用 Google 帐号成功登录 Logto 后将用户重定向回你的应用。此处这个值应为 `${your_logto_endpoint}/callback/${connector_id}`。`connector_id` 在管理控制台相应连接器的详情页的顶栏中可以找到。例如:`https://logto.dev/callback/${connector_id}`。
131
- - 点击「创建」后,你将获得「客户端 ID」(Client ID)和「客户端密钥」(Client Secret)。
132
-
133
- ### 配置类型
134
-
135
- | 名称 | 类型 |
136
- |--------------|--------|
137
- | clientId | string |
138
- | clientSecret | string |
139
- ## 参考
140
- * [Google Identity: 设置 OAuth 2.0](https://developers.google.com/identity/protocols/oauth2/openid-connect#appsetup)
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ConnectorPlatform, parseJson, ConnectorError, ConnectorErrorCodes, ConnectorType, validateConfig } from '@logto/connector-kit';
1
+ import { ConnectorPlatform, ConnectorConfigFormItemType, parseJson, ConnectorError, ConnectorErrorCodes, ConnectorType, validateConfig } from '@logto/connector-kit';
2
2
  import { got, HTTPError } from 'got';
3
3
  import { z } from 'zod';
4
4
 
@@ -40,7 +40,22 @@ const defaultMetadata = {
40
40
  ko: 'Google은 가장 큰 검색 엔진 기술과 이메일 서비스 제공자입니다.', // UNTRANSLATED
41
41
  },
42
42
  readme: './README.md',
43
- configTemplate: './docs/config-template.json',
43
+ formItems: [
44
+ {
45
+ key: 'clientId',
46
+ type: ConnectorConfigFormItemType.Text,
47
+ label: 'Client ID',
48
+ required: true,
49
+ placeholder: '<client-id>',
50
+ },
51
+ {
52
+ key: 'clientSecret',
53
+ type: ConnectorConfigFormItemType.Text,
54
+ label: 'Client Secret',
55
+ required: true,
56
+ placeholder: '<client-secret>',
57
+ },
58
+ ],
44
59
  };
45
60
  const defaultTimeout = 5000;
46
61
 
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",
@@ -51,7 +51,7 @@
51
51
  "access": "public"
52
52
  },
53
53
  "name": "@logto/connector-google",
54
- "version": "1.0.0-beta.19",
54
+ "version": "1.0.0-beta.21",
55
55
  "description": "Google web connector implementation.",
56
56
  "author": "Silverhand Inc. <contact@silverhand.io>",
57
57
  "scripts": {
@@ -1,4 +0,0 @@
1
- {
2
- "clientId": "<client-id>",
3
- "clientSecret": "<client-secret>"
4
- }