@shware/security 2.5.3 → 3.0.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/dist/auth/index.cjs +519 -561
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +104 -106
- package/dist/auth/index.d.cts.map +1 -0
- package/dist/auth/index.d.mts +109 -0
- package/dist/auth/index.d.mts.map +1 -0
- package/dist/auth/index.mjs +512 -536
- package/dist/auth/index.mjs.map +1 -1
- package/dist/auth/types.cjs +0 -19
- package/dist/auth/types.d.cts +44 -44
- package/dist/auth/types.d.cts.map +1 -0
- package/dist/auth/types.d.mts +50 -0
- package/dist/auth/types.d.mts.map +1 -0
- package/dist/auth/types.mjs +1 -1
- package/dist/core/index.cjs +18 -59
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +13 -24
- package/dist/core/index.d.cts.map +1 -0
- package/dist/core/index.d.mts +21 -0
- package/dist/core/index.d.mts.map +1 -0
- package/dist/core/index.mjs +17 -33
- package/dist/core/index.mjs.map +1 -1
- package/dist/email/schema.cjs +13 -38
- package/dist/email/schema.cjs.map +1 -1
- package/dist/email/schema.d.cts +11 -12
- package/dist/email/schema.d.cts.map +1 -0
- package/dist/email/schema.d.mts +12 -0
- package/dist/email/schema.d.mts.map +1 -0
- package/dist/email/schema.mjs +10 -11
- package/dist/email/schema.mjs.map +1 -1
- package/dist/index.cjs +18 -54
- package/dist/index.d.cts +10 -15
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +5 -17
- package/dist/oauth2/client.cjs +109 -145
- package/dist/oauth2/client.cjs.map +1 -1
- package/dist/oauth2/client.d.cts +55 -56
- package/dist/oauth2/client.d.cts.map +1 -0
- package/dist/oauth2/client.d.mts +58 -0
- package/dist/oauth2/client.d.mts.map +1 -0
- package/dist/oauth2/client.mjs +104 -116
- package/dist/oauth2/client.mjs.map +1 -1
- package/dist/oauth2/error.cjs +19 -44
- package/dist/oauth2/error.cjs.map +1 -1
- package/dist/oauth2/error.d.cts +8 -6
- package/dist/oauth2/error.d.cts.map +1 -0
- package/dist/oauth2/{error.d.ts → error.d.mts} +8 -6
- package/dist/oauth2/error.d.mts.map +1 -0
- package/dist/oauth2/error.mjs +18 -19
- package/dist/oauth2/error.mjs.map +1 -1
- package/dist/oauth2/provider/apple.cjs +75 -88
- package/dist/oauth2/provider/apple.cjs.map +1 -1
- package/dist/oauth2/provider/apple.d.cts +31 -30
- package/dist/oauth2/provider/apple.d.cts.map +1 -0
- package/dist/oauth2/provider/apple.d.mts +42 -0
- package/dist/oauth2/provider/apple.d.mts.map +1 -0
- package/dist/oauth2/provider/apple.mjs +71 -60
- package/dist/oauth2/provider/apple.mjs.map +1 -1
- package/dist/oauth2/provider/common.cjs +86 -109
- package/dist/oauth2/provider/common.cjs.map +1 -1
- package/dist/oauth2/provider/common.d.cts +19 -18
- package/dist/oauth2/provider/common.d.cts.map +1 -0
- package/dist/oauth2/provider/common.d.mts +30 -0
- package/dist/oauth2/provider/common.d.mts.map +1 -0
- package/dist/oauth2/provider/common.mjs +80 -79
- package/dist/oauth2/provider/common.mjs.map +1 -1
- package/dist/oauth2/provider/facebook.cjs +93 -109
- package/dist/oauth2/provider/facebook.cjs.map +1 -1
- package/dist/oauth2/provider/facebook.d.cts +29 -28
- package/dist/oauth2/provider/facebook.d.cts.map +1 -0
- package/dist/oauth2/provider/facebook.d.mts +45 -0
- package/dist/oauth2/provider/facebook.d.mts.map +1 -0
- package/dist/oauth2/provider/facebook.mjs +89 -81
- package/dist/oauth2/provider/facebook.mjs.map +1 -1
- package/dist/oauth2/provider/github.cjs +64 -91
- package/dist/oauth2/provider/github.cjs.map +1 -1
- package/dist/oauth2/provider/github.d.cts +52 -51
- package/dist/oauth2/provider/github.d.cts.map +1 -0
- package/dist/oauth2/provider/github.d.mts +60 -0
- package/dist/oauth2/provider/github.d.mts.map +1 -0
- package/dist/oauth2/provider/github.mjs +60 -63
- package/dist/oauth2/provider/github.mjs.map +1 -1
- package/dist/oauth2/provider/google.cjs +105 -122
- package/dist/oauth2/provider/google.cjs.map +1 -1
- package/dist/oauth2/provider/google.d.cts +34 -33
- package/dist/oauth2/provider/google.d.cts.map +1 -0
- package/dist/oauth2/provider/google.d.mts +44 -0
- package/dist/oauth2/provider/google.d.mts.map +1 -0
- package/dist/oauth2/provider/google.mjs +101 -94
- package/dist/oauth2/provider/google.mjs.map +1 -1
- package/dist/oauth2/provider/index.cjs +13 -46
- package/dist/oauth2/provider/index.d.cts +7 -7
- package/dist/oauth2/provider/index.d.mts +7 -0
- package/dist/oauth2/provider/index.mjs +1 -10
- package/dist/oauth2/provider/wechat.cjs +77 -99
- package/dist/oauth2/provider/wechat.cjs.map +1 -1
- package/dist/oauth2/provider/wechat.d.cts +28 -27
- package/dist/oauth2/provider/wechat.d.cts.map +1 -0
- package/dist/oauth2/provider/wechat.d.mts +39 -0
- package/dist/oauth2/provider/wechat.d.mts.map +1 -0
- package/dist/oauth2/provider/wechat.mjs +74 -72
- package/dist/oauth2/provider/wechat.mjs.map +1 -1
- package/dist/oauth2/provider/x.cjs +102 -125
- package/dist/oauth2/provider/x.cjs.map +1 -1
- package/dist/oauth2/provider/x.d.cts +51 -50
- package/dist/oauth2/provider/x.d.cts.map +1 -0
- package/dist/oauth2/provider/x.d.mts +69 -0
- package/dist/oauth2/provider/x.d.mts.map +1 -0
- package/dist/oauth2/provider/x.mjs +99 -103
- package/dist/oauth2/provider/x.mjs.map +1 -1
- package/dist/oauth2/types.cjs +12 -37
- package/dist/oauth2/types.cjs.map +1 -1
- package/dist/oauth2/types.d.cts +176 -180
- package/dist/oauth2/types.d.cts.map +1 -0
- package/dist/oauth2/types.d.mts +207 -0
- package/dist/oauth2/types.d.mts.map +1 -0
- package/dist/oauth2/types.mjs +12 -13
- package/dist/oauth2/types.mjs.map +1 -1
- package/dist/session/common.cjs +17 -43
- package/dist/session/common.cjs.map +1 -1
- package/dist/session/common.d.cts +4 -4
- package/dist/session/common.d.cts.map +1 -0
- package/dist/session/{common.d.ts → common.d.mts} +4 -4
- package/dist/session/common.d.mts.map +1 -0
- package/dist/session/common.mjs +14 -16
- package/dist/session/common.mjs.map +1 -1
- package/dist/session/db.cjs +88 -123
- package/dist/session/db.cjs.map +1 -1
- package/dist/session/db.d.cts +36 -36
- package/dist/session/db.d.cts.map +1 -0
- package/dist/session/db.d.mts +44 -0
- package/dist/session/db.d.mts.map +1 -0
- package/dist/session/db.mjs +84 -95
- package/dist/session/db.mjs.map +1 -1
- package/dist/session/map-session.cjs +71 -103
- package/dist/session/map-session.cjs.map +1 -1
- package/dist/session/map-session.d.cts +24 -24
- package/dist/session/map-session.d.cts.map +1 -0
- package/dist/session/map-session.d.mts +27 -0
- package/dist/session/map-session.d.mts.map +1 -0
- package/dist/session/map-session.mjs +70 -78
- package/dist/session/map-session.mjs.map +1 -1
- package/dist/session/redis.cjs +270 -319
- package/dist/session/redis.cjs.map +1 -1
- package/dist/session/redis.d.cts +51 -51
- package/dist/session/redis.d.cts.map +1 -0
- package/dist/session/redis.d.mts +58 -0
- package/dist/session/redis.d.mts.map +1 -0
- package/dist/session/redis.mjs +266 -291
- package/dist/session/redis.mjs.map +1 -1
- package/dist/session/types.cjs +0 -19
- package/dist/session/types.d.cts +34 -33
- package/dist/session/types.d.cts.map +1 -0
- package/dist/session/types.d.mts +45 -0
- package/dist/session/types.d.mts.map +1 -0
- package/dist/session/types.mjs +1 -1
- package/dist/utils/http.cjs +31 -55
- package/dist/utils/http.cjs.map +1 -1
- package/dist/utils/http.d.cts +7 -10
- package/dist/utils/http.d.cts.map +1 -0
- package/dist/utils/{http.d.ts → http.d.mts} +7 -10
- package/dist/utils/http.d.mts.map +1 -0
- package/dist/utils/http.mjs +24 -24
- package/dist/utils/http.mjs.map +1 -1
- package/dist/utils/oauth2.cjs +6 -30
- package/dist/utils/oauth2.cjs.map +1 -1
- package/dist/utils/oauth2.d.cts +3 -1
- package/dist/utils/oauth2.d.cts.map +1 -0
- package/dist/utils/oauth2.d.mts +5 -0
- package/dist/utils/oauth2.d.mts.map +1 -0
- package/dist/utils/oauth2.mjs +5 -5
- package/dist/utils/oauth2.mjs.map +1 -1
- package/dist/utils/timing.cjs +49 -70
- package/dist/utils/timing.cjs.map +1 -1
- package/dist/utils/timing.d.cts +10 -8
- package/dist/utils/timing.d.cts.map +1 -0
- package/dist/utils/timing.d.mts +15 -0
- package/dist/utils/timing.d.mts.map +1 -0
- package/dist/utils/timing.mjs +48 -45
- package/dist/utils/timing.mjs.map +1 -1
- package/dist/utils/valid.cjs +50 -71
- package/dist/utils/valid.cjs.map +1 -1
- package/dist/utils/valid.d.cts +17 -16
- package/dist/utils/valid.d.cts.map +1 -0
- package/dist/utils/valid.d.mts +28 -0
- package/dist/utils/valid.d.mts.map +1 -0
- package/dist/utils/valid.mjs +47 -44
- package/dist/utils/valid.mjs.map +1 -1
- package/package.json +22 -12
- package/dist/auth/index.d.ts +0 -111
- package/dist/auth/types.cjs.map +0 -1
- package/dist/auth/types.d.ts +0 -50
- package/dist/auth/types.mjs.map +0 -1
- package/dist/core/index.d.ts +0 -32
- package/dist/email/schema.d.ts +0 -13
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -15
- package/dist/index.mjs.map +0 -1
- package/dist/oauth2/client.d.ts +0 -59
- package/dist/oauth2/provider/apple.d.ts +0 -41
- package/dist/oauth2/provider/common.d.ts +0 -29
- package/dist/oauth2/provider/facebook.d.ts +0 -44
- package/dist/oauth2/provider/github.d.ts +0 -59
- package/dist/oauth2/provider/google.d.ts +0 -43
- package/dist/oauth2/provider/index.cjs.map +0 -1
- package/dist/oauth2/provider/index.d.ts +0 -7
- package/dist/oauth2/provider/index.mjs.map +0 -1
- package/dist/oauth2/provider/wechat.d.ts +0 -38
- package/dist/oauth2/provider/x.d.ts +0 -68
- package/dist/oauth2/types.d.ts +0 -211
- package/dist/session/__tests__/redis.test.cjs +0 -247
- package/dist/session/__tests__/redis.test.cjs.map +0 -1
- package/dist/session/__tests__/redis.test.d.cts +0 -2
- package/dist/session/__tests__/redis.test.d.ts +0 -2
- package/dist/session/__tests__/redis.test.mjs +0 -252
- package/dist/session/__tests__/redis.test.mjs.map +0 -1
- package/dist/session/db.d.ts +0 -44
- package/dist/session/map-session.d.ts +0 -27
- package/dist/session/redis.d.ts +0 -58
- package/dist/session/types.cjs.map +0 -1
- package/dist/session/types.d.ts +0 -44
- package/dist/session/types.mjs.map +0 -1
- package/dist/utils/oauth2.d.ts +0 -3
- package/dist/utils/timing.d.ts +0 -13
- package/dist/utils/valid.d.ts +0 -27
|
@@ -1,125 +1,108 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/oauth2/provider/google.ts
|
|
21
|
-
var google_exports = {};
|
|
22
|
-
__export(google_exports, {
|
|
23
|
-
createGoogleProvider: () => createGoogleProvider,
|
|
24
|
-
google: () => google
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(google_exports);
|
|
27
|
-
var import_utils = require("@shware/utils");
|
|
28
|
-
var import_error = require("../error.cjs");
|
|
29
|
-
var import_common = require("./common.cjs");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_oauth2_error = require("../error.cjs");
|
|
3
|
+
const require_oauth2_provider_common = require("./common.cjs");
|
|
4
|
+
let _shware_utils = require("@shware/utils");
|
|
5
|
+
//#region src/oauth2/provider/google.ts
|
|
30
6
|
function createGoogleProvider() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
7
|
+
return {
|
|
8
|
+
authorizationUri: "https://accounts.google.com/o/oauth2/v2/auth",
|
|
9
|
+
tokenUri: "https://oauth2.googleapis.com/token",
|
|
10
|
+
userInfoUri: "https://www.googleapis.com/oauth2/v3/userinfo",
|
|
11
|
+
userNameAttribute: "sub",
|
|
12
|
+
jwkSetUri: "https://www.googleapis.com/oauth2/v3/certs",
|
|
13
|
+
defaultScope: [
|
|
14
|
+
"https://www.googleapis.com/auth/userinfo.email",
|
|
15
|
+
"https://www.googleapis.com/auth/userinfo.profile",
|
|
16
|
+
"openid"
|
|
17
|
+
],
|
|
18
|
+
createAuthorizationUri(params) {
|
|
19
|
+
return require_oauth2_provider_common.createAuthorizationUri({
|
|
20
|
+
...params,
|
|
21
|
+
scope: params.scope ?? this.defaultScope,
|
|
22
|
+
authorizationUri: this.authorizationUri
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
async exchangeAuthorizationCode(params) {
|
|
26
|
+
const response = await require_oauth2_provider_common.exchangeAuthorizationCode({
|
|
27
|
+
...params,
|
|
28
|
+
tokenUri: this.tokenUri
|
|
29
|
+
});
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const { error, error_description } = await response.json();
|
|
32
|
+
throw new require_oauth2_error.OAuth2Error(response.status, error, error_description);
|
|
33
|
+
}
|
|
34
|
+
return await response.json();
|
|
35
|
+
},
|
|
36
|
+
async getUserInfo({ id_token }) {
|
|
37
|
+
(0, _shware_utils.invariant)(id_token, "id_token is required");
|
|
38
|
+
(0, _shware_utils.invariant)(this.jwkSetUri, "jwkSetUri is required");
|
|
39
|
+
const data = await require_oauth2_provider_common.verifyIdToken(id_token, this.jwkSetUri);
|
|
40
|
+
return {
|
|
41
|
+
data,
|
|
42
|
+
claims: {
|
|
43
|
+
sub: data.sub,
|
|
44
|
+
name: data.name,
|
|
45
|
+
picture: data.picture,
|
|
46
|
+
email: data.email,
|
|
47
|
+
email_verified: data.email_verified,
|
|
48
|
+
given_name: data.given_name,
|
|
49
|
+
family_name: data.family_name,
|
|
50
|
+
locale: data.locale
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
async loginOAuth2Native({ pkce: _, credentials, ...params }) {
|
|
55
|
+
(0, _shware_utils.invariant)(credentials.code, "code is required");
|
|
56
|
+
const { code } = credentials;
|
|
57
|
+
const { tokenUri } = this;
|
|
58
|
+
const response = await require_oauth2_provider_common.exchangeAuthorizationCode({
|
|
59
|
+
code,
|
|
60
|
+
tokenUri,
|
|
61
|
+
...params
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
const { error, error_description } = await response.json();
|
|
65
|
+
throw new require_oauth2_error.OAuth2Error(response.status, error, error_description);
|
|
66
|
+
}
|
|
67
|
+
const token = await response.json();
|
|
68
|
+
return {
|
|
69
|
+
token,
|
|
70
|
+
userInfo: await this.getUserInfo(token)
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
async getTokenInfo(id_token) {
|
|
74
|
+
(0, _shware_utils.invariant)(id_token, "id_token is required");
|
|
75
|
+
(0, _shware_utils.invariant)(this.jwkSetUri, "jwkSetUri is required");
|
|
76
|
+
const data = await require_oauth2_provider_common.verifyIdToken(id_token, this.jwkSetUri);
|
|
77
|
+
return {
|
|
78
|
+
token: {
|
|
79
|
+
id_token,
|
|
80
|
+
access_token: "",
|
|
81
|
+
token_type: "",
|
|
82
|
+
expires_in: 0,
|
|
83
|
+
refresh_token: "",
|
|
84
|
+
scope: ""
|
|
85
|
+
},
|
|
86
|
+
userInfo: {
|
|
87
|
+
data,
|
|
88
|
+
claims: {
|
|
89
|
+
sub: data.sub,
|
|
90
|
+
name: data.name,
|
|
91
|
+
picture: data.picture,
|
|
92
|
+
email: data.email,
|
|
93
|
+
email_verified: data.email_verified,
|
|
94
|
+
given_name: data.given_name,
|
|
95
|
+
family_name: data.family_name,
|
|
96
|
+
locale: data.locale
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
};
|
|
118
102
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
});
|
|
103
|
+
const google = createGoogleProvider();
|
|
104
|
+
//#endregion
|
|
105
|
+
exports.createGoogleProvider = createGoogleProvider;
|
|
106
|
+
exports.google = google;
|
|
107
|
+
|
|
125
108
|
//# sourceMappingURL=google.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/oauth2/provider/google.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport { OAuth2Error } from '../error';\nimport type {\n LoginOAuth2NativeParams,\n NativeCredential,\n OAuth2Token,\n OneTapProvider,\n} from '../types';\nimport { createAuthorizationUri, exchangeAuthorizationCode, verifyIdToken } from './common';\n\nexport function createGoogleProvider(): OneTapProvider {\n return {\n authorizationUri: 'https://accounts.google.com/o/oauth2/v2/auth',\n tokenUri: 'https://oauth2.googleapis.com/token',\n userInfoUri: 'https://www.googleapis.com/oauth2/v3/userinfo',\n userNameAttribute: 'sub',\n jwkSetUri: 'https://www.googleapis.com/oauth2/v3/certs',\n // https://developers.google.com/identity/protocols/oauth2/scopes#oauth2\n defaultScope: [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ],\n createAuthorizationUri(params) {\n return createAuthorizationUri({\n ...params,\n scope: params.scope ?? this.defaultScope,\n authorizationUri: this.authorizationUri,\n });\n },\n async exchangeAuthorizationCode(params) {\n const response = await exchangeAuthorizationCode({ ...params, tokenUri: this.tokenUri });\n if (!response.ok) {\n const { error, error_description } = (await response.json()) as GoogleErrorResponse;\n throw new OAuth2Error(response.status, error, error_description);\n }\n return (await response.json()) as GoogleToken;\n },\n async getUserInfo({ id_token }) {\n invariant(id_token, 'id_token is required');\n invariant(this.jwkSetUri, 'jwkSetUri is required');\n const data = await verifyIdToken<GoogleUserInfo>(id_token, this.jwkSetUri);\n return {\n data,\n claims: {\n sub: data.sub,\n name: data.name,\n picture: data.picture,\n email: data.email,\n email_verified: data.email_verified,\n given_name: data.given_name,\n family_name: data.family_name,\n locale: data.locale,\n },\n };\n },\n async loginOAuth2Native({ pkce: _, credentials, ...params }: LoginOAuth2NativeParams) {\n invariant(credentials.code, 'code is required');\n const { code } = credentials;\n const { tokenUri } = this;\n const response = await exchangeAuthorizationCode({ code, tokenUri, ...params });\n if (!response.ok) {\n const { error, error_description } = (await response.json()) as GoogleErrorResponse;\n throw new OAuth2Error(response.status, error, error_description);\n }\n const token = (await response.json()) as GoogleToken;\n const userInfo = await this.getUserInfo(token);\n return { token, userInfo };\n },\n async getTokenInfo(id_token: string) {\n invariant(id_token, 'id_token is required');\n invariant(this.jwkSetUri, 'jwkSetUri is required');\n const data = await verifyIdToken<GoogleUserInfo>(id_token, this.jwkSetUri);\n return {\n token: {\n id_token,\n access_token: '',\n token_type: '',\n expires_in: 0,\n refresh_token: '',\n scope: '',\n },\n userInfo: {\n data,\n claims: {\n sub: data.sub,\n name: data.name,\n picture: data.picture,\n email: data.email,\n email_verified: data.email_verified,\n given_name: data.given_name,\n family_name: data.family_name,\n locale: data.locale,\n },\n },\n };\n },\n };\n}\n\nexport const google = createGoogleProvider();\n\nexport interface GoogleUserInfo {\n aud: string;\n azp: string;\n email: string;\n email_verified: boolean;\n exp: number;\n family_name: string;\n given_name: string;\n hd?: string;\n iat: number;\n iss: string;\n jti?: string;\n locale?: string;\n name: string;\n nbf?: number;\n picture: string;\n sub: string;\n nonce?: string;\n}\n\nexport interface GoogleToken extends OAuth2Token {\n access_token: string;\n token_type: string;\n expires_in: number;\n refresh_token: string;\n id_token: string;\n scope: string;\n}\n\n// android,ios has different client_id and redirect_uri\nexport interface GoogleAppCredential extends NativeCredential {\n state: string;\n code: string;\n client_id: string;\n redirect_uri: string;\n}\n\nexport interface GoogleErrorResponse {\n error:\n | 'invalid_request'\n | 'invalid_client'\n | 'invalid_grant'\n | 'invalid_token'\n | 'invalid_scope'\n | 'unauthorized_client'\n | 'unsupported_grant_type'\n | 'access_denied'\n | 'server_error';\n error_description: string;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"google.cjs","names":["createAuthorizationUri","exchangeAuthorizationCode","OAuth2Error","verifyIdToken"],"sources":["../../../src/oauth2/provider/google.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport { OAuth2Error } from '../error';\nimport type {\n LoginOAuth2NativeParams,\n NativeCredential,\n OAuth2Token,\n OneTapProvider,\n} from '../types';\nimport { createAuthorizationUri, exchangeAuthorizationCode, verifyIdToken } from './common';\n\nexport function createGoogleProvider(): OneTapProvider {\n return {\n authorizationUri: 'https://accounts.google.com/o/oauth2/v2/auth',\n tokenUri: 'https://oauth2.googleapis.com/token',\n userInfoUri: 'https://www.googleapis.com/oauth2/v3/userinfo',\n userNameAttribute: 'sub',\n jwkSetUri: 'https://www.googleapis.com/oauth2/v3/certs',\n // https://developers.google.com/identity/protocols/oauth2/scopes#oauth2\n defaultScope: [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ],\n createAuthorizationUri(params) {\n return createAuthorizationUri({\n ...params,\n scope: params.scope ?? this.defaultScope,\n authorizationUri: this.authorizationUri,\n });\n },\n async exchangeAuthorizationCode(params) {\n const response = await exchangeAuthorizationCode({ ...params, tokenUri: this.tokenUri });\n if (!response.ok) {\n const { error, error_description } = (await response.json()) as GoogleErrorResponse;\n throw new OAuth2Error(response.status, error, error_description);\n }\n return (await response.json()) as GoogleToken;\n },\n async getUserInfo({ id_token }) {\n invariant(id_token, 'id_token is required');\n invariant(this.jwkSetUri, 'jwkSetUri is required');\n const data = await verifyIdToken<GoogleUserInfo>(id_token, this.jwkSetUri);\n return {\n data,\n claims: {\n sub: data.sub,\n name: data.name,\n picture: data.picture,\n email: data.email,\n email_verified: data.email_verified,\n given_name: data.given_name,\n family_name: data.family_name,\n locale: data.locale,\n },\n };\n },\n async loginOAuth2Native({ pkce: _, credentials, ...params }: LoginOAuth2NativeParams) {\n invariant(credentials.code, 'code is required');\n const { code } = credentials;\n const { tokenUri } = this;\n const response = await exchangeAuthorizationCode({ code, tokenUri, ...params });\n if (!response.ok) {\n const { error, error_description } = (await response.json()) as GoogleErrorResponse;\n throw new OAuth2Error(response.status, error, error_description);\n }\n const token = (await response.json()) as GoogleToken;\n const userInfo = await this.getUserInfo(token);\n return { token, userInfo };\n },\n async getTokenInfo(id_token: string) {\n invariant(id_token, 'id_token is required');\n invariant(this.jwkSetUri, 'jwkSetUri is required');\n const data = await verifyIdToken<GoogleUserInfo>(id_token, this.jwkSetUri);\n return {\n token: {\n id_token,\n access_token: '',\n token_type: '',\n expires_in: 0,\n refresh_token: '',\n scope: '',\n },\n userInfo: {\n data,\n claims: {\n sub: data.sub,\n name: data.name,\n picture: data.picture,\n email: data.email,\n email_verified: data.email_verified,\n given_name: data.given_name,\n family_name: data.family_name,\n locale: data.locale,\n },\n },\n };\n },\n };\n}\n\nexport const google = createGoogleProvider();\n\nexport interface GoogleUserInfo {\n aud: string;\n azp: string;\n email: string;\n email_verified: boolean;\n exp: number;\n family_name: string;\n given_name: string;\n hd?: string;\n iat: number;\n iss: string;\n jti?: string;\n locale?: string;\n name: string;\n nbf?: number;\n picture: string;\n sub: string;\n nonce?: string;\n}\n\nexport interface GoogleToken extends OAuth2Token {\n access_token: string;\n token_type: string;\n expires_in: number;\n refresh_token: string;\n id_token: string;\n scope: string;\n}\n\n// android,ios has different client_id and redirect_uri\nexport interface GoogleAppCredential extends NativeCredential {\n state: string;\n code: string;\n client_id: string;\n redirect_uri: string;\n}\n\nexport interface GoogleErrorResponse {\n error:\n | 'invalid_request'\n | 'invalid_client'\n | 'invalid_grant'\n | 'invalid_token'\n | 'invalid_scope'\n | 'unauthorized_client'\n | 'unsupported_grant_type'\n | 'access_denied'\n | 'server_error';\n error_description: string;\n}\n"],"mappings":";;;;;AAUA,SAAgB,uBAAuC;CACrD,OAAO;EACL,kBAAkB;EAClB,UAAU;EACV,aAAa;EACb,mBAAmB;EACnB,WAAW;EAEX,cAAc;GACZ;GACA;GACA;EACF;EACA,uBAAuB,QAAQ;GAC7B,OAAOA,+BAAAA,uBAAuB;IAC5B,GAAG;IACH,OAAO,OAAO,SAAS,KAAK;IAC5B,kBAAkB,KAAK;GACzB,CAAC;EACH;EACA,MAAM,0BAA0B,QAAQ;GACtC,MAAM,WAAW,MAAMC,+BAAAA,0BAA0B;IAAE,GAAG;IAAQ,UAAU,KAAK;GAAS,CAAC;GACvF,IAAI,CAAC,SAAS,IAAI;IAChB,MAAM,EAAE,OAAO,sBAAuB,MAAM,SAAS,KAAK;IAC1D,MAAM,IAAIC,qBAAAA,YAAY,SAAS,QAAQ,OAAO,iBAAiB;GACjE;GACA,OAAQ,MAAM,SAAS,KAAK;EAC9B;EACA,MAAM,YAAY,EAAE,YAAY;GAC9B,CAAA,GAAA,cAAA,UAAA,CAAU,UAAU,sBAAsB;GAC1C,CAAA,GAAA,cAAA,UAAA,CAAU,KAAK,WAAW,uBAAuB;GACjD,MAAM,OAAO,MAAMC,+BAAAA,cAA8B,UAAU,KAAK,SAAS;GACzE,OAAO;IACL;IACA,QAAQ;KACN,KAAK,KAAK;KACV,MAAM,KAAK;KACX,SAAS,KAAK;KACd,OAAO,KAAK;KACZ,gBAAgB,KAAK;KACrB,YAAY,KAAK;KACjB,aAAa,KAAK;KAClB,QAAQ,KAAK;IACf;GACF;EACF;EACA,MAAM,kBAAkB,EAAE,MAAM,GAAG,aAAa,GAAG,UAAmC;GACpF,CAAA,GAAA,cAAA,UAAA,CAAU,YAAY,MAAM,kBAAkB;GAC9C,MAAM,EAAE,SAAS;GACjB,MAAM,EAAE,aAAa;GACrB,MAAM,WAAW,MAAMF,+BAAAA,0BAA0B;IAAE;IAAM;IAAU,GAAG;GAAO,CAAC;GAC9E,IAAI,CAAC,SAAS,IAAI;IAChB,MAAM,EAAE,OAAO,sBAAuB,MAAM,SAAS,KAAK;IAC1D,MAAM,IAAIC,qBAAAA,YAAY,SAAS,QAAQ,OAAO,iBAAiB;GACjE;GACA,MAAM,QAAS,MAAM,SAAS,KAAK;GAEnC,OAAO;IAAE;IAAO,UAAA,MADO,KAAK,YAAY,KAAK;GACpB;EAC3B;EACA,MAAM,aAAa,UAAkB;GACnC,CAAA,GAAA,cAAA,UAAA,CAAU,UAAU,sBAAsB;GAC1C,CAAA,GAAA,cAAA,UAAA,CAAU,KAAK,WAAW,uBAAuB;GACjD,MAAM,OAAO,MAAMC,+BAAAA,cAA8B,UAAU,KAAK,SAAS;GACzE,OAAO;IACL,OAAO;KACL;KACA,cAAc;KACd,YAAY;KACZ,YAAY;KACZ,eAAe;KACf,OAAO;IACT;IACA,UAAU;KACR;KACA,QAAQ;MACN,KAAK,KAAK;MACV,MAAM,KAAK;MACX,SAAS,KAAK;MACd,OAAO,KAAK;MACZ,gBAAgB,KAAK;MACrB,YAAY,KAAK;MACjB,aAAa,KAAK;MAClB,QAAQ,KAAK;KACf;IACF;GACF;EACF;CACF;AACF;AAEA,MAAa,SAAS,qBAAqB"}
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { NativeCredential, OAuth2Token, OneTapProvider } from
|
|
2
|
-
|
|
1
|
+
import { NativeCredential, OAuth2Token, OneTapProvider } from "../types.cjs";
|
|
2
|
+
//#region src/oauth2/provider/google.d.ts
|
|
3
3
|
declare function createGoogleProvider(): OneTapProvider;
|
|
4
4
|
declare const google: OneTapProvider;
|
|
5
5
|
interface GoogleUserInfo {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
aud: string;
|
|
7
|
+
azp: string;
|
|
8
|
+
email: string;
|
|
9
|
+
email_verified: boolean;
|
|
10
|
+
exp: number;
|
|
11
|
+
family_name: string;
|
|
12
|
+
given_name: string;
|
|
13
|
+
hd?: string;
|
|
14
|
+
iat: number;
|
|
15
|
+
iss: string;
|
|
16
|
+
jti?: string;
|
|
17
|
+
locale?: string;
|
|
18
|
+
name: string;
|
|
19
|
+
nbf?: number;
|
|
20
|
+
picture: string;
|
|
21
|
+
sub: string;
|
|
22
|
+
nonce?: string;
|
|
23
23
|
}
|
|
24
24
|
interface GoogleToken extends OAuth2Token {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
access_token: string;
|
|
26
|
+
token_type: string;
|
|
27
|
+
expires_in: number;
|
|
28
|
+
refresh_token: string;
|
|
29
|
+
id_token: string;
|
|
30
|
+
scope: string;
|
|
31
31
|
}
|
|
32
32
|
interface GoogleAppCredential extends NativeCredential {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
state: string;
|
|
34
|
+
code: string;
|
|
35
|
+
client_id: string;
|
|
36
|
+
redirect_uri: string;
|
|
37
37
|
}
|
|
38
38
|
interface GoogleErrorResponse {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
error: 'invalid_request' | 'invalid_client' | 'invalid_grant' | 'invalid_token' | 'invalid_scope' | 'unauthorized_client' | 'unsupported_grant_type' | 'access_denied' | 'server_error';
|
|
40
|
+
error_description: string;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
export {
|
|
42
|
+
//#endregion
|
|
43
|
+
export { GoogleAppCredential, GoogleErrorResponse, GoogleToken, GoogleUserInfo, createGoogleProvider, google };
|
|
44
|
+
//# sourceMappingURL=google.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google.d.cts","names":[],"sources":["../../../src/oauth2/provider/google.ts"],"mappings":";;iBAUgB,wBAAwB;cA0F3B,QAAM;UAEF;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,oBAAoB;EACnC;EACA;EACA;EACA;EACA;EACA;;UAIe,4BAA4B;EAC3C;EACA;EACA;EACA;;UAGe;EACf;EAUA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { NativeCredential, OAuth2Token, OneTapProvider } from "../types.mjs";
|
|
2
|
+
//#region src/oauth2/provider/google.d.ts
|
|
3
|
+
declare function createGoogleProvider(): OneTapProvider;
|
|
4
|
+
declare const google: OneTapProvider;
|
|
5
|
+
interface GoogleUserInfo {
|
|
6
|
+
aud: string;
|
|
7
|
+
azp: string;
|
|
8
|
+
email: string;
|
|
9
|
+
email_verified: boolean;
|
|
10
|
+
exp: number;
|
|
11
|
+
family_name: string;
|
|
12
|
+
given_name: string;
|
|
13
|
+
hd?: string;
|
|
14
|
+
iat: number;
|
|
15
|
+
iss: string;
|
|
16
|
+
jti?: string;
|
|
17
|
+
locale?: string;
|
|
18
|
+
name: string;
|
|
19
|
+
nbf?: number;
|
|
20
|
+
picture: string;
|
|
21
|
+
sub: string;
|
|
22
|
+
nonce?: string;
|
|
23
|
+
}
|
|
24
|
+
interface GoogleToken extends OAuth2Token {
|
|
25
|
+
access_token: string;
|
|
26
|
+
token_type: string;
|
|
27
|
+
expires_in: number;
|
|
28
|
+
refresh_token: string;
|
|
29
|
+
id_token: string;
|
|
30
|
+
scope: string;
|
|
31
|
+
}
|
|
32
|
+
interface GoogleAppCredential extends NativeCredential {
|
|
33
|
+
state: string;
|
|
34
|
+
code: string;
|
|
35
|
+
client_id: string;
|
|
36
|
+
redirect_uri: string;
|
|
37
|
+
}
|
|
38
|
+
interface GoogleErrorResponse {
|
|
39
|
+
error: 'invalid_request' | 'invalid_client' | 'invalid_grant' | 'invalid_token' | 'invalid_scope' | 'unauthorized_client' | 'unsupported_grant_type' | 'access_denied' | 'server_error';
|
|
40
|
+
error_description: string;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { GoogleAppCredential, GoogleErrorResponse, GoogleToken, GoogleUserInfo, createGoogleProvider, google };
|
|
44
|
+
//# sourceMappingURL=google.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google.d.mts","names":[],"sources":["../../../src/oauth2/provider/google.ts"],"mappings":";;iBAUgB,wBAAwB;cA0F3B,QAAM;UAEF;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,oBAAoB;EACnC;EACA;EACA;EACA;EACA;EACA;;UAIe,4BAA4B;EAC3C;EACA;EACA;EACA;;UAGe;EACf;EAUA"}
|
|
@@ -1,99 +1,106 @@
|
|
|
1
|
-
// src/oauth2/provider/google.ts
|
|
2
|
-
import { invariant } from "@shware/utils";
|
|
3
1
|
import { OAuth2Error } from "../error.mjs";
|
|
4
2
|
import { createAuthorizationUri, exchangeAuthorizationCode, verifyIdToken } from "./common.mjs";
|
|
3
|
+
import { invariant } from "@shware/utils";
|
|
4
|
+
//#region src/oauth2/provider/google.ts
|
|
5
5
|
function createGoogleProvider() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
6
|
+
return {
|
|
7
|
+
authorizationUri: "https://accounts.google.com/o/oauth2/v2/auth",
|
|
8
|
+
tokenUri: "https://oauth2.googleapis.com/token",
|
|
9
|
+
userInfoUri: "https://www.googleapis.com/oauth2/v3/userinfo",
|
|
10
|
+
userNameAttribute: "sub",
|
|
11
|
+
jwkSetUri: "https://www.googleapis.com/oauth2/v3/certs",
|
|
12
|
+
defaultScope: [
|
|
13
|
+
"https://www.googleapis.com/auth/userinfo.email",
|
|
14
|
+
"https://www.googleapis.com/auth/userinfo.profile",
|
|
15
|
+
"openid"
|
|
16
|
+
],
|
|
17
|
+
createAuthorizationUri(params) {
|
|
18
|
+
return createAuthorizationUri({
|
|
19
|
+
...params,
|
|
20
|
+
scope: params.scope ?? this.defaultScope,
|
|
21
|
+
authorizationUri: this.authorizationUri
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
async exchangeAuthorizationCode(params) {
|
|
25
|
+
const response = await exchangeAuthorizationCode({
|
|
26
|
+
...params,
|
|
27
|
+
tokenUri: this.tokenUri
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
const { error, error_description } = await response.json();
|
|
31
|
+
throw new OAuth2Error(response.status, error, error_description);
|
|
32
|
+
}
|
|
33
|
+
return await response.json();
|
|
34
|
+
},
|
|
35
|
+
async getUserInfo({ id_token }) {
|
|
36
|
+
invariant(id_token, "id_token is required");
|
|
37
|
+
invariant(this.jwkSetUri, "jwkSetUri is required");
|
|
38
|
+
const data = await verifyIdToken(id_token, this.jwkSetUri);
|
|
39
|
+
return {
|
|
40
|
+
data,
|
|
41
|
+
claims: {
|
|
42
|
+
sub: data.sub,
|
|
43
|
+
name: data.name,
|
|
44
|
+
picture: data.picture,
|
|
45
|
+
email: data.email,
|
|
46
|
+
email_verified: data.email_verified,
|
|
47
|
+
given_name: data.given_name,
|
|
48
|
+
family_name: data.family_name,
|
|
49
|
+
locale: data.locale
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
async loginOAuth2Native({ pkce: _, credentials, ...params }) {
|
|
54
|
+
invariant(credentials.code, "code is required");
|
|
55
|
+
const { code } = credentials;
|
|
56
|
+
const { tokenUri } = this;
|
|
57
|
+
const response = await exchangeAuthorizationCode({
|
|
58
|
+
code,
|
|
59
|
+
tokenUri,
|
|
60
|
+
...params
|
|
61
|
+
});
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
const { error, error_description } = await response.json();
|
|
64
|
+
throw new OAuth2Error(response.status, error, error_description);
|
|
65
|
+
}
|
|
66
|
+
const token = await response.json();
|
|
67
|
+
return {
|
|
68
|
+
token,
|
|
69
|
+
userInfo: await this.getUserInfo(token)
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
async getTokenInfo(id_token) {
|
|
73
|
+
invariant(id_token, "id_token is required");
|
|
74
|
+
invariant(this.jwkSetUri, "jwkSetUri is required");
|
|
75
|
+
const data = await verifyIdToken(id_token, this.jwkSetUri);
|
|
76
|
+
return {
|
|
77
|
+
token: {
|
|
78
|
+
id_token,
|
|
79
|
+
access_token: "",
|
|
80
|
+
token_type: "",
|
|
81
|
+
expires_in: 0,
|
|
82
|
+
refresh_token: "",
|
|
83
|
+
scope: ""
|
|
84
|
+
},
|
|
85
|
+
userInfo: {
|
|
86
|
+
data,
|
|
87
|
+
claims: {
|
|
88
|
+
sub: data.sub,
|
|
89
|
+
name: data.name,
|
|
90
|
+
picture: data.picture,
|
|
91
|
+
email: data.email,
|
|
92
|
+
email_verified: data.email_verified,
|
|
93
|
+
given_name: data.given_name,
|
|
94
|
+
family_name: data.family_name,
|
|
95
|
+
locale: data.locale
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
93
101
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
102
|
+
const google = createGoogleProvider();
|
|
103
|
+
//#endregion
|
|
104
|
+
export { createGoogleProvider, google };
|
|
105
|
+
|
|
99
106
|
//# sourceMappingURL=google.mjs.map
|