Updates
This commit is contained in:
@@ -34,8 +34,10 @@ export default async function googleAuth({
|
||||
apiUserID,
|
||||
debug,
|
||||
}: Param): Promise<APILoginFunctionReturn> {
|
||||
const grabedHostNames = grabHostNames();
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
const grabedHostNames = grabHostNames({
|
||||
userId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||
});
|
||||
const { host, port, scheme, user_id } = grabedHostNames;
|
||||
|
||||
const finalEncryptionKey =
|
||||
encryptionKey || process.env.DSQL_ENCRYPTION_PASSWORD;
|
||||
@@ -107,12 +109,6 @@ export default async function googleAuth({
|
||||
debug,
|
||||
});
|
||||
} 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) => {
|
||||
const reqPayload = JSON.stringify({
|
||||
token,
|
||||
@@ -179,7 +175,7 @@ export default async function googleAuth({
|
||||
|
||||
const cookieNames = getAuthCookieNames({
|
||||
database,
|
||||
userId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||
userId: user_id,
|
||||
});
|
||||
|
||||
if (httpResponse.csrf) {
|
||||
|
||||
@@ -105,6 +105,7 @@ export default function userAuth({
|
||||
success: false,
|
||||
payload: null,
|
||||
msg: "Couldn't Decrypt cookie",
|
||||
cookieNames: keyNames,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -127,6 +128,7 @@ export default function userAuth({
|
||||
success: false,
|
||||
payload: null,
|
||||
msg: "No CSRF_K in decrypted payload",
|
||||
cookieNames: keyNames,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -135,6 +137,7 @@ export default function userAuth({
|
||||
success: false,
|
||||
payload: null,
|
||||
msg: "Auth file doesn't exist",
|
||||
cookieNames: keyNames,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -152,6 +155,7 @@ export default function userAuth({
|
||||
success: false,
|
||||
payload: null,
|
||||
msg: "CSRF_K mismatch",
|
||||
cookieNames: keyNames,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -166,6 +170,7 @@ export default function userAuth({
|
||||
success: false,
|
||||
payload: null,
|
||||
msg: "Payload Creation Date is not a number",
|
||||
cookieNames: keyNames,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -180,6 +185,7 @@ export default function userAuth({
|
||||
success: false,
|
||||
payload: null,
|
||||
msg: "Session has expired",
|
||||
cookieNames: keyNames,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user