@logto/connector-google 1.0.0-beta.8

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.
@@ -0,0 +1,3 @@
1
+ import { Config } from '@silverhand/jest-config';
2
+ declare const config: Config.InitialOptions;
3
+ export default config;
@@ -0,0 +1,7 @@
1
+ import { ConnectorMetadata } from '@logto/connector-core';
2
+ export declare const authorizationEndpoint = "https://accounts.google.com/o/oauth2/v2/auth";
3
+ export declare const accessTokenEndpoint = "https://oauth2.googleapis.com/token";
4
+ export declare const userInfoEndpoint = "https://openidconnect.googleapis.com/v1/userinfo";
5
+ export declare const scope = "openid profile email";
6
+ export declare const defaultMetadata: ConnectorMetadata;
7
+ export declare const defaultTimeout = 5000;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The Implementation of OpenID Connect of Google Identity Platform.
3
+ * https://developers.google.com/identity/protocols/oauth2/openid-connect
4
+ */
5
+ import { CreateConnector, SocialConnector } from '@logto/connector-core';
6
+ import { GoogleConfig } from './types';
7
+ export declare const getAccessToken: (config: GoogleConfig, codeObject: {
8
+ code: string;
9
+ redirectUri: string;
10
+ }) => Promise<{
11
+ accessToken: string;
12
+ }>;
13
+ declare const createGoogleConnector: CreateConnector<SocialConnector>;
14
+ export default createGoogleConnector;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const mockedConfig: {
2
+ clientId: string;
3
+ clientSecret: string;
4
+ };
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod';
2
+ export declare const googleConfigGuard: z.ZodObject<{
3
+ clientId: z.ZodString;
4
+ clientSecret: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ clientId: string;
7
+ clientSecret: string;
8
+ }, {
9
+ clientId: string;
10
+ clientSecret: string;
11
+ }>;
12
+ export declare type GoogleConfig = z.infer<typeof googleConfigGuard>;
13
+ export declare const accessTokenResponseGuard: z.ZodObject<{
14
+ access_token: z.ZodString;
15
+ scope: z.ZodString;
16
+ token_type: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ scope: string;
19
+ access_token: string;
20
+ token_type: string;
21
+ }, {
22
+ scope: string;
23
+ access_token: string;
24
+ token_type: string;
25
+ }>;
26
+ export declare type AccessTokenResponse = z.infer<typeof accessTokenResponseGuard>;
27
+ export declare const userInfoResponseGuard: z.ZodObject<{
28
+ sub: z.ZodString;
29
+ name: z.ZodOptional<z.ZodString>;
30
+ given_name: z.ZodOptional<z.ZodString>;
31
+ family_name: z.ZodOptional<z.ZodString>;
32
+ picture: z.ZodOptional<z.ZodString>;
33
+ email: z.ZodOptional<z.ZodString>;
34
+ email_verified: z.ZodOptional<z.ZodBoolean>;
35
+ locale: z.ZodOptional<z.ZodString>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ name?: string | undefined;
38
+ given_name?: string | undefined;
39
+ family_name?: string | undefined;
40
+ picture?: string | undefined;
41
+ email?: string | undefined;
42
+ email_verified?: boolean | undefined;
43
+ locale?: string | undefined;
44
+ sub: string;
45
+ }, {
46
+ name?: string | undefined;
47
+ given_name?: string | undefined;
48
+ family_name?: string | undefined;
49
+ picture?: string | undefined;
50
+ email?: string | undefined;
51
+ email_verified?: boolean | undefined;
52
+ locale?: string | undefined;
53
+ sub: string;
54
+ }>;
55
+ export declare type UserInfoResponse = z.infer<typeof userInfoResponseGuard>;
56
+ export declare const authResponseGuard: z.ZodObject<{
57
+ code: z.ZodString;
58
+ redirectUri: z.ZodString;
59
+ }, "strip", z.ZodTypeAny, {
60
+ code: string;
61
+ redirectUri: string;
62
+ }, {
63
+ code: string;
64
+ redirectUri: string;
65
+ }>;
package/logo.svg ADDED
@@ -0,0 +1,6 @@
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"/>
6
+ </svg>
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@logto/connector-google",
3
+ "version": "1.0.0-beta.8",
4
+ "description": "Google web connector implementation.",
5
+ "main": "./lib/index.js",
6
+ "exports": "./lib/index.js",
7
+ "author": "Silverhand Inc. <contact@silverhand.io>",
8
+ "license": "MPL-2.0",
9
+ "files": [
10
+ "lib",
11
+ "docs",
12
+ "logo.svg",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "precommit": "lint-staged",
17
+ "build": "rm -rf lib/ && ncc build src/index.ts -o lib",
18
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
19
+ "lint": "eslint --ext .ts src",
20
+ "lint:report": "pnpm lint --format json --output-file report.json",
21
+ "test": "jest",
22
+ "test:coverage": "jest --coverage --silent",
23
+ "prepack": "pnpm build"
24
+ },
25
+ "dependencies": {
26
+ "@logto/connector-core": "^1.0.0-beta.8",
27
+ "@silverhand/essentials": "^1.2.0",
28
+ "@silverhand/jest-config": "1.0.0-rc.3",
29
+ "got": "^11.8.2",
30
+ "zod": "^3.14.3"
31
+ },
32
+ "devDependencies": {
33
+ "@jest/types": "^28.1.3",
34
+ "@silverhand/eslint-config": "1.0.0-rc.2",
35
+ "@silverhand/ts-config": "1.0.0-rc.2",
36
+ "@types/jest": "^28.1.6",
37
+ "@types/node": "^16.3.1",
38
+ "@vercel/ncc": "^0.34.0",
39
+ "eslint": "^8.21.0",
40
+ "jest": "^28.1.3",
41
+ "jest-matcher-specific-error": "^1.0.0",
42
+ "lint-staged": "^13.0.0",
43
+ "nock": "^13.2.2",
44
+ "prettier": "^2.7.1",
45
+ "typescript": "^4.7.4"
46
+ },
47
+ "engines": {
48
+ "node": "^16.0.0"
49
+ },
50
+ "eslintConfig": {
51
+ "extends": "@silverhand"
52
+ },
53
+ "prettier": "@silverhand/eslint-config/.prettierrc",
54
+ "publishConfig": {
55
+ "access": "public"
56
+ },
57
+ "gitHead": "301bd23b49395f90a2b0b37a774e2bdeb1208cf1"
58
+ }