@logto/connector-google 1.0.0-beta.18 → 1.0.0-beta.20

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/logo.svg CHANGED
@@ -1,6 +1,6 @@
1
1
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M20.64 12.2046C20.64 11.5664 20.5827 10.9527 20.4764 10.3636H12V13.845H16.8436C16.635 14.97 16.0009 15.9232 15.0477 16.5614V18.8196H17.9564C19.6582 17.2527 20.64 14.9455 20.64 12.2046Z" fill="#4285F4"/>
3
- <path fill-rule="evenodd" clip-rule="evenodd" d="M11.9998 21C14.4298 21 16.467 20.1941 17.9561 18.8195L15.0475 16.5613C14.2416 17.1013 13.2107 17.4204 11.9998 17.4204C9.65567 17.4204 7.67158 15.8372 6.96385 13.71H3.95703V16.0418C5.43794 18.9831 8.48158 21 11.9998 21Z" fill="#34A853"/>
4
- <path fill-rule="evenodd" clip-rule="evenodd" d="M6.96409 13.7099C6.78409 13.1699 6.68182 12.5931 6.68182 11.9999C6.68182 11.4068 6.78409 10.8299 6.96409 10.2899V7.95813H3.95727C3.34773 9.17313 3 10.5477 3 11.9999C3 13.4522 3.34773 14.8268 3.95727 16.0418L6.96409 13.7099Z" fill="#FBBC05"/>
5
- <path fill-rule="evenodd" clip-rule="evenodd" d="M11.9998 6.57955C13.3211 6.57955 14.5075 7.03364 15.4402 7.92545L18.0216 5.34409C16.4629 3.89182 14.4257 3 11.9998 3C8.48158 3 5.43794 5.01682 3.95703 7.95818L6.96385 10.29C7.67158 8.16273 9.65567 6.57955 11.9998 6.57955Z" fill="#EA4335"/>
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M23.52 12.2729C23.52 11.422 23.4436 10.6038 23.3018 9.81836H12V14.4602H18.4582C18.18 15.9602 17.3345 17.2311 16.0636 18.082V21.0929H19.9418C22.2109 19.0038 23.52 15.9275 23.52 12.2729Z" fill="#4285F4"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 23.9999C15.24 23.9999 17.9564 22.9254 19.9418 21.0926L16.0636 18.0817C14.9891 18.8017 13.6145 19.2272 12 19.2272C8.87455 19.2272 6.22909 17.1163 5.28546 14.2799H1.27637V17.389C3.25091 21.3108 7.30909 23.9999 12 23.9999Z" fill="#34A853"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.28545 14.2798C5.04545 13.5598 4.90909 12.7907 4.90909 11.9998C4.90909 11.2089 5.04545 10.4398 5.28545 9.71981V6.61072H1.27636C0.463636 8.23072 0 10.0634 0 11.9998C0 13.9362 0.463636 15.7689 1.27636 17.3889L5.28545 14.2798Z" fill="#FBBC05"/>
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 4.77273C13.7618 4.77273 15.3436 5.37818 16.5873 6.56727L20.0291 3.12545C17.9509 1.18909 15.2345 0 12 0C7.30909 0 3.25091 2.68909 1.27637 6.61091L5.28546 9.72C6.22909 6.88364 8.87455 4.77273 12 4.77273Z" fill="#EA4335"/>
6
6
  </svg>
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.0",
14
+ "@logto/connector-kit": "1.0.0-rc.2",
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.18",
54
+ "version": "1.0.0-beta.20",
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
- }