Google Login Bugfix
This commit is contained in:
parent
06de31dcb2
commit
64ee344ba1
@ -24,8 +24,10 @@ const write_auth_files_1 = require("../../../functions/backend/auth/write-auth-f
|
|||||||
function googleAuth(_a) {
|
function googleAuth(_a) {
|
||||||
return __awaiter(this, arguments, void 0, function* ({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, }) {
|
return __awaiter(this, arguments, void 0, function* ({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, }) {
|
||||||
var _b;
|
var _b;
|
||||||
const grabedHostNames = (0, grab_host_names_1.default)();
|
const grabedHostNames = (0, grab_host_names_1.default)({
|
||||||
const { host, port, scheme } = grabedHostNames;
|
userId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||||
|
});
|
||||||
|
const { host, port, scheme, user_id } = grabedHostNames;
|
||||||
const finalEncryptionKey = encryptionKey || process.env.DSQL_ENCRYPTION_PASSWORD;
|
const finalEncryptionKey = encryptionKey || process.env.DSQL_ENCRYPTION_PASSWORD;
|
||||||
const finalEncryptionSalt = encryptionSalt || process.env.DSQL_ENCRYPTION_SALT;
|
const finalEncryptionSalt = encryptionSalt || process.env.DSQL_ENCRYPTION_SALT;
|
||||||
if (!(finalEncryptionKey === null || finalEncryptionKey === void 0 ? void 0 : finalEncryptionKey.match(/.{8,}/))) {
|
if (!(finalEncryptionKey === null || finalEncryptionKey === void 0 ? void 0 : finalEncryptionKey.match(/.{8,}/))) {
|
||||||
@ -84,12 +86,6 @@ function googleAuth(_a) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/**
|
|
||||||
* Make https request
|
|
||||||
*
|
|
||||||
* @description make a request to datasquirel.com
|
|
||||||
* @type {{ success: boolean, user: import("../../../types").DATASQUIREL_LoggedInUser | null, msg?: string, dsqlUserId?: number } | null } - Https response object
|
|
||||||
*/
|
|
||||||
httpResponse = yield new Promise((resolve, reject) => {
|
httpResponse = yield new Promise((resolve, reject) => {
|
||||||
const reqPayload = JSON.stringify({
|
const reqPayload = JSON.stringify({
|
||||||
token,
|
token,
|
||||||
@ -144,7 +140,7 @@ function googleAuth(_a) {
|
|||||||
});
|
});
|
||||||
const cookieNames = (0, get_auth_cookie_names_1.default)({
|
const cookieNames = (0, get_auth_cookie_names_1.default)({
|
||||||
database,
|
database,
|
||||||
userId: apiUserID || process.env.DSQL_API_USER_ID,
|
userId: user_id,
|
||||||
});
|
});
|
||||||
if (httpResponse.csrf) {
|
if (httpResponse.csrf) {
|
||||||
(0, write_auth_files_1.writeAuthFile)(httpResponse.csrf, JSON.stringify(httpResponse.payload));
|
(0, write_auth_files_1.writeAuthFile)(httpResponse.csrf, JSON.stringify(httpResponse.payload));
|
||||||
|
@ -34,8 +34,10 @@ export default async function googleAuth({
|
|||||||
apiUserID,
|
apiUserID,
|
||||||
debug,
|
debug,
|
||||||
}: Param): Promise<APILoginFunctionReturn> {
|
}: Param): Promise<APILoginFunctionReturn> {
|
||||||
const grabedHostNames = grabHostNames();
|
const grabedHostNames = grabHostNames({
|
||||||
const { host, port, scheme } = grabedHostNames;
|
userId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||||
|
});
|
||||||
|
const { host, port, scheme, user_id } = grabedHostNames;
|
||||||
|
|
||||||
const finalEncryptionKey =
|
const finalEncryptionKey =
|
||||||
encryptionKey || process.env.DSQL_ENCRYPTION_PASSWORD;
|
encryptionKey || process.env.DSQL_ENCRYPTION_PASSWORD;
|
||||||
@ -107,12 +109,6 @@ export default async function googleAuth({
|
|||||||
debug,
|
debug,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
/**
|
|
||||||
* Make https request
|
|
||||||
*
|
|
||||||
* @description make a request to datasquirel.com
|
|
||||||
* @type {{ success: boolean, user: import("../../../types").DATASQUIREL_LoggedInUser | null, msg?: string, dsqlUserId?: number } | null } - Https response object
|
|
||||||
*/
|
|
||||||
httpResponse = await new Promise((resolve, reject) => {
|
httpResponse = await new Promise((resolve, reject) => {
|
||||||
const reqPayload = JSON.stringify({
|
const reqPayload = JSON.stringify({
|
||||||
token,
|
token,
|
||||||
@ -179,7 +175,7 @@ export default async function googleAuth({
|
|||||||
|
|
||||||
const cookieNames = getAuthCookieNames({
|
const cookieNames = getAuthCookieNames({
|
||||||
database,
|
database,
|
||||||
userId: apiUserID || process.env.DSQL_API_USER_ID,
|
userId: user_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (httpResponse.csrf) {
|
if (httpResponse.csrf) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "3.9.8",
|
"version": "3.9.9",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user