@logto/connector-google 1.2.0 → 1.4.0
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 +25 -19
- package/lib/constant.d.ts +1 -0
- package/lib/index.d.ts +2 -3
- package/lib/index.js +1222 -22
- package/lib/types.d.ts +11 -14
- package/package.json +29 -5
package/README.md
CHANGED
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
The Google connector provides a succinct way for your application to use Google’s OAuth 2.0 authentication system.
|
|
4
4
|
|
|
5
5
|
**Table of contents**
|
|
6
|
-
- [Google
|
|
7
|
-
|
|
8
|
-
- [Configure your
|
|
9
|
-
|
|
10
|
-
- [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- [
|
|
16
|
-
|
|
17
|
-
- [References](#references)
|
|
6
|
+
- [Set up a project in the Google API Console](#set-up-a-project-in-the-google-api-console)
|
|
7
|
+
- [Configure your consent screen](#configure-your-consent-screen)
|
|
8
|
+
- [Configure and register your application](#configure-and-register-your-application)
|
|
9
|
+
- [Edit app registration](#edit-app-registration)
|
|
10
|
+
- [Config OAuth consent screen](#config-oauth-consent-screen)
|
|
11
|
+
- [Config scopes](#config-scopes)
|
|
12
|
+
- [Add test users (External user type only)](#add-test-users-external-user-type-only)
|
|
13
|
+
- [Obtain OAuth 2.0 credentials](#obtain-oauth-20-credentials)
|
|
14
|
+
- [Configure your connector](#configure-your-connector)
|
|
15
|
+
- [Config types](#config-types)
|
|
16
|
+
- [References](#references)
|
|
18
17
|
|
|
19
18
|
## Set up a project in the Google API Console
|
|
20
19
|
|
|
@@ -57,8 +56,8 @@ Now you should have the Google OAuth 2.0 consent screen configured.
|
|
|
57
56
|
- On the **Credentials** page, click the **+ CREATE CREDENTIALS** button on the top menu bar, and select **OAuth client ID**.
|
|
58
57
|
- On the **Create OAuth client ID** page, select **Web application** as the application type.
|
|
59
58
|
- Fill out the basic information for your application.
|
|
60
|
-
- Click **+ Add URI** to add an authorized domain to the **Authorized JavaScript origins** section. This is the domain that your logto authorization page will be served from. In our case, this will be `${
|
|
61
|
-
- Click **+ Add URI** in the ****Authorized redirect URIs**** section to set up the ****Authorized redirect URIs****, which redirect the user to the application after logging in. In our case, this will be `${your_logto_endpoint}/callback/${connector_id}`. e.g. `https://logto.
|
|
59
|
+
- Click **+ Add URI** to add an authorized domain to the **Authorized JavaScript origins** section. This is the domain that your logto authorization page will be served from. In our case, this will be `${your_logto_endpoint_origin}`. e.g.`https://foo.logto.app`.
|
|
60
|
+
- Click **+ Add URI** in the ****Authorized redirect URIs**** section to set up the ****Authorized redirect URIs****, which redirect the user to the application after logging in. In our case, this will be `${your_logto_endpoint}/callback/${connector_id}`. e.g. `https://foo.logto.app/callback/${connector_id}`. The `connector_id` can be found on the top bar of the Logto Admin Console connector details page.
|
|
62
61
|
- Click **Create** to finish and then you will get the **Client ID** and **Client Secret**.
|
|
63
62
|
|
|
64
63
|
## Configure your connector
|
|
@@ -67,13 +66,20 @@ Fill out the `clientId` and `clientSecret` field with _Client ID_ and _Client Se
|
|
|
67
66
|
|
|
68
67
|
`scope` is a space-delimited list of [scopes](https://developers.google.com/identity/protocols/oauth2/scopes). If not provided, scope defaults to be `openid profile email`.
|
|
69
68
|
|
|
69
|
+
`prompts` is an array of strings that specifies the type of user interaction that is required. The string can be one of the following values:
|
|
70
|
+
|
|
71
|
+
- `none`: The authorization server does not display any authentication or user consent screens; it will return an error if the user is not already authenticated and has not pre-configured consent for the requested scopes. You can use none to check for existing authentication and/or consent.
|
|
72
|
+
- `consent`: The authorization server prompts the user for consent before returning information to the client.
|
|
73
|
+
- `select_account`: The authorization server prompts the user to select a user account. This allows a user who has multiple accounts at the authorization server to select amongst the multiple accounts that they may have current sessions for.
|
|
74
|
+
|
|
70
75
|
### Config types
|
|
71
76
|
|
|
72
|
-
| Name | Type
|
|
73
|
-
|
|
74
|
-
| clientId | string
|
|
75
|
-
| clientSecret | string
|
|
76
|
-
| scope | string
|
|
77
|
+
| Name | Type |
|
|
78
|
+
|--------------|----------|
|
|
79
|
+
| clientId | string |
|
|
80
|
+
| clientSecret | string |
|
|
81
|
+
| scope | string |
|
|
82
|
+
| prompts | string[] |
|
|
77
83
|
|
|
78
84
|
## References
|
|
79
85
|
* [Google Identity: Setting up OAuth 2.0](https://developers.google.com/identity/protocols/oauth2/openid-connect#appsetup)
|
package/lib/constant.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export declare const userInfoEndpoint = "https://openidconnect.googleapis.com/v1
|
|
|
5
5
|
export declare const scope = "openid profile email";
|
|
6
6
|
export declare const defaultMetadata: ConnectorMetadata;
|
|
7
7
|
export declare const defaultTimeout = 5000;
|
|
8
|
+
export declare const jwksUri = "https://www.googleapis.com/oauth2/v3/certs";
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { CreateConnector, SocialConnector } from '@logto/connector-kit';
|
|
2
|
-
|
|
3
|
-
export declare const getAccessToken: (config: GoogleConfig, codeObject: {
|
|
1
|
+
import type { CreateConnector, SocialConnector, GoogleConnectorConfig } from '@logto/connector-kit';
|
|
2
|
+
export declare const getAccessToken: (config: GoogleConnectorConfig, codeObject: {
|
|
4
3
|
code: string;
|
|
5
4
|
redirectUri: string;
|
|
6
5
|
}) => Promise<{
|