naystack 1.5.21 → 1.5.22
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/google/get.cjs.js +5 -2
- package/dist/auth/google/get.esm.js +5 -2
- package/dist/auth/google/index.cjs.js +5 -2
- package/dist/auth/google/index.d.mts +1 -1
- package/dist/auth/google/index.d.ts +1 -1
- package/dist/auth/google/index.esm.js +5 -2
- package/dist/auth/index.cjs.js +5 -2
- package/dist/auth/index.esm.js +5 -2
- package/package.json +1 -1
|
@@ -107,7 +107,9 @@ var getGoogleGetRoute = ({
|
|
|
107
107
|
const code = req.nextUrl.searchParams.get("code");
|
|
108
108
|
const error = req.nextUrl.searchParams.get("error");
|
|
109
109
|
if (!code && !error) {
|
|
110
|
-
const
|
|
110
|
+
const data = req.nextUrl.searchParams.get("data");
|
|
111
|
+
const stateData = { data, id: (0, import_uuid.v4)() };
|
|
112
|
+
const state2 = JSON.stringify(stateData);
|
|
111
113
|
const authorizationUrl = oauth2Client.generateAuthUrl({
|
|
112
114
|
scope: [
|
|
113
115
|
"https://www.googleapis.com/auth/userinfo.profile",
|
|
@@ -141,7 +143,8 @@ var getGoogleGetRoute = ({
|
|
|
141
143
|
}).userinfo.get();
|
|
142
144
|
const user = userInfoRequest.data;
|
|
143
145
|
if (user.email) {
|
|
144
|
-
const
|
|
146
|
+
const { data } = JSON.parse(localState);
|
|
147
|
+
const id = await getUserIdFromEmail(user, data);
|
|
145
148
|
const res = import_server2.NextResponse.redirect(redirectURL);
|
|
146
149
|
if (id) {
|
|
147
150
|
res.cookies.set(
|
|
@@ -83,7 +83,9 @@ var getGoogleGetRoute = ({
|
|
|
83
83
|
const code = req.nextUrl.searchParams.get("code");
|
|
84
84
|
const error = req.nextUrl.searchParams.get("error");
|
|
85
85
|
if (!code && !error) {
|
|
86
|
-
const
|
|
86
|
+
const data = req.nextUrl.searchParams.get("data");
|
|
87
|
+
const stateData = { data, id: v4() };
|
|
88
|
+
const state2 = JSON.stringify(stateData);
|
|
87
89
|
const authorizationUrl = oauth2Client.generateAuthUrl({
|
|
88
90
|
scope: [
|
|
89
91
|
"https://www.googleapis.com/auth/userinfo.profile",
|
|
@@ -117,7 +119,8 @@ var getGoogleGetRoute = ({
|
|
|
117
119
|
}).userinfo.get();
|
|
118
120
|
const user = userInfoRequest.data;
|
|
119
121
|
if (user.email) {
|
|
120
|
-
const
|
|
122
|
+
const { data } = JSON.parse(localState);
|
|
123
|
+
const id = await getUserIdFromEmail(user, data);
|
|
121
124
|
const res = NextResponse2.redirect(redirectURL);
|
|
122
125
|
if (id) {
|
|
123
126
|
res.cookies.set(
|
|
@@ -109,7 +109,9 @@ var getGoogleGetRoute = ({
|
|
|
109
109
|
const code = req.nextUrl.searchParams.get("code");
|
|
110
110
|
const error = req.nextUrl.searchParams.get("error");
|
|
111
111
|
if (!code && !error) {
|
|
112
|
-
const
|
|
112
|
+
const data = req.nextUrl.searchParams.get("data");
|
|
113
|
+
const stateData = { data, id: (0, import_uuid.v4)() };
|
|
114
|
+
const state2 = JSON.stringify(stateData);
|
|
113
115
|
const authorizationUrl = oauth2Client.generateAuthUrl({
|
|
114
116
|
scope: [
|
|
115
117
|
"https://www.googleapis.com/auth/userinfo.profile",
|
|
@@ -143,7 +145,8 @@ var getGoogleGetRoute = ({
|
|
|
143
145
|
}).userinfo.get();
|
|
144
146
|
const user = userInfoRequest.data;
|
|
145
147
|
if (user.email) {
|
|
146
|
-
const
|
|
148
|
+
const { data } = JSON.parse(localState);
|
|
149
|
+
const id = await getUserIdFromEmail(user, data);
|
|
147
150
|
const res = import_server2.NextResponse.redirect(redirectURL);
|
|
148
151
|
if (id) {
|
|
149
152
|
res.cookies.set(
|
|
@@ -13,7 +13,7 @@ type Schema$Userinfo = oauth2_v2.Schema$Userinfo;
|
|
|
13
13
|
* @category Auth
|
|
14
14
|
*/
|
|
15
15
|
interface InitGoogleAuthOptions {
|
|
16
|
-
getUserIdFromEmail: (email: Schema$Userinfo) => Promise<number | null>;
|
|
16
|
+
getUserIdFromEmail: (email: Schema$Userinfo, data?: object) => Promise<number | null>;
|
|
17
17
|
redirectURL: string;
|
|
18
18
|
errorRedirectURL?: string;
|
|
19
19
|
}
|
|
@@ -13,7 +13,7 @@ type Schema$Userinfo = oauth2_v2.Schema$Userinfo;
|
|
|
13
13
|
* @category Auth
|
|
14
14
|
*/
|
|
15
15
|
interface InitGoogleAuthOptions {
|
|
16
|
-
getUserIdFromEmail: (email: Schema$Userinfo) => Promise<number | null>;
|
|
16
|
+
getUserIdFromEmail: (email: Schema$Userinfo, data?: object) => Promise<number | null>;
|
|
17
17
|
redirectURL: string;
|
|
18
18
|
errorRedirectURL?: string;
|
|
19
19
|
}
|
|
@@ -83,7 +83,9 @@ var getGoogleGetRoute = ({
|
|
|
83
83
|
const code = req.nextUrl.searchParams.get("code");
|
|
84
84
|
const error = req.nextUrl.searchParams.get("error");
|
|
85
85
|
if (!code && !error) {
|
|
86
|
-
const
|
|
86
|
+
const data = req.nextUrl.searchParams.get("data");
|
|
87
|
+
const stateData = { data, id: v4() };
|
|
88
|
+
const state2 = JSON.stringify(stateData);
|
|
87
89
|
const authorizationUrl = oauth2Client.generateAuthUrl({
|
|
88
90
|
scope: [
|
|
89
91
|
"https://www.googleapis.com/auth/userinfo.profile",
|
|
@@ -117,7 +119,8 @@ var getGoogleGetRoute = ({
|
|
|
117
119
|
}).userinfo.get();
|
|
118
120
|
const user = userInfoRequest.data;
|
|
119
121
|
if (user.email) {
|
|
120
|
-
const
|
|
122
|
+
const { data } = JSON.parse(localState);
|
|
123
|
+
const id = await getUserIdFromEmail(user, data);
|
|
121
124
|
const res = NextResponse2.redirect(redirectURL);
|
|
122
125
|
if (id) {
|
|
123
126
|
res.cookies.set(
|
package/dist/auth/index.cjs.js
CHANGED
|
@@ -410,7 +410,9 @@ var getGoogleGetRoute = ({
|
|
|
410
410
|
const code = req.nextUrl.searchParams.get("code");
|
|
411
411
|
const error = req.nextUrl.searchParams.get("error");
|
|
412
412
|
if (!code && !error) {
|
|
413
|
-
const
|
|
413
|
+
const data = req.nextUrl.searchParams.get("data");
|
|
414
|
+
const stateData = { data, id: (0, import_uuid.v4)() };
|
|
415
|
+
const state2 = JSON.stringify(stateData);
|
|
414
416
|
const authorizationUrl = oauth2Client.generateAuthUrl({
|
|
415
417
|
scope: [
|
|
416
418
|
"https://www.googleapis.com/auth/userinfo.profile",
|
|
@@ -444,7 +446,8 @@ var getGoogleGetRoute = ({
|
|
|
444
446
|
}).userinfo.get();
|
|
445
447
|
const user = userInfoRequest.data;
|
|
446
448
|
if (user.email) {
|
|
447
|
-
const
|
|
449
|
+
const { data } = JSON.parse(localState);
|
|
450
|
+
const id = await getUserIdFromEmail(user, data);
|
|
448
451
|
const res = import_server5.NextResponse.redirect(redirectURL);
|
|
449
452
|
if (id) {
|
|
450
453
|
res.cookies.set(
|
package/dist/auth/index.esm.js
CHANGED
|
@@ -371,7 +371,9 @@ var getGoogleGetRoute = ({
|
|
|
371
371
|
const code = req.nextUrl.searchParams.get("code");
|
|
372
372
|
const error = req.nextUrl.searchParams.get("error");
|
|
373
373
|
if (!code && !error) {
|
|
374
|
-
const
|
|
374
|
+
const data = req.nextUrl.searchParams.get("data");
|
|
375
|
+
const stateData = { data, id: v4() };
|
|
376
|
+
const state2 = JSON.stringify(stateData);
|
|
375
377
|
const authorizationUrl = oauth2Client.generateAuthUrl({
|
|
376
378
|
scope: [
|
|
377
379
|
"https://www.googleapis.com/auth/userinfo.profile",
|
|
@@ -405,7 +407,8 @@ var getGoogleGetRoute = ({
|
|
|
405
407
|
}).userinfo.get();
|
|
406
408
|
const user = userInfoRequest.data;
|
|
407
409
|
if (user.email) {
|
|
408
|
-
const
|
|
410
|
+
const { data } = JSON.parse(localState);
|
|
411
|
+
const id = await getUserIdFromEmail(user, data);
|
|
409
412
|
const res = NextResponse3.redirect(redirectURL);
|
|
410
413
|
if (id) {
|
|
411
414
|
res.cookies.set(
|