Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

sendVerificationCodeMutation not working #17

Open
marcioscf opened this issue Jul 13, 2023 · 3 comments
Open

sendVerificationCodeMutation not working #17

marcioscf opened this issue Jul 13, 2023 · 3 comments

Comments

@marcioscf
Copy link

Okay, so I have tested manually if the https://github.com/cemalgnlts/Mailjs would work as a new service for email.
Doing the steps by hand, works just fine, and I even initialized the changes on the project at the mail file.
The problem is: The mutation to try and send the verification code is not working and i coulddnt get it to work at all.
If anyone can help me get it to work, I can manage to update the mail config to the auto email login and renew function

@muharamdani
Copy link
Owner

Hi, I'm not quite understand by "the mutation to try and send the verification code". Do you mean that when we choose the auto login and fill the email, it didn't send the email? Also, can you provide the changes on mail file to me? Thank you

@marcioscf
Copy link
Author

Whenever i try to send the verification code via the mutation, it gives a 401 bad request error.
I can't get it to work no mather what I try and it did not send the email.
And sure! Here is the code for mail file:

`import Mailjs from "@cemalgnlts/mailjs";

const createNewEmail = async () => {
const mailjs = new Mailjs();
const email = await mailjs.createOneAccount();

return {
email: (email.data as any).username,
password: (email.data as any).password,
};
};

const getEmailList = async (logged) => {
return await logged.getMessages();
};

const getLatestEmail = async (logged) => {
let emailList = await getEmailList(logged);
let emailListLength = 0;
while (emailListLength === 0) {
await new Promise((r) => setTimeout(r, 1500));
emailList = await getEmailList(logged);
emailListLength = emailList.data.length;
}
return emailList.data[0];
};
const getEmailContent = async (logged, id) => {
const content = await logged.getMessage(id);
const resp = /\b(?<!#)\d{6}\b/g.exec(content.data.html)?.[0];
return resp
};
const getPoeOTPCode = async (email, pw) => {
const mailjs = new Mailjs();
await mailjs.login(email, pw);

const emailData = await getLatestEmail(mailjs);
return await getEmailContent(mailjs, emailData.id);
};
export {
createNewEmail,
getEmailList,
getLatestEmail,
getEmailContent,
getPoeOTPCode,
};
`

@muharamdani
Copy link
Owner

I think it caused by missing recaptchaToken on send verification code mutation, especially from queryName "MainSignupLoginSection_sendVerificationCodeMutation_Mutation", since the code didn't send the token, it will cause 401 bad request.

Actually, the recaptchaToken can be get from https://www.recaptcha.net/recaptcha/enterprise/reload, but it takes k query params and some request payload which I don't have any idea where the payload come from.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants