This repository has been archived by the owner on Aug 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from muharamdani/refactor/automation-login
Refactor/automation login
- Loading branch information
Showing
9 changed files
with
452 additions
and
2,393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
QUORA_FORMKEY=your_formkey | ||
MB_COOKIE=your_cookie | ||
FORMKEY=your_formkey | ||
COOKIE=your_cookie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import fetch from "cross-fetch"; | ||
import { readFileSync, writeFile } from "fs"; | ||
const BASEURL = 'https://api.guerrillamail.com/ajax.php'; | ||
const createNewEmail = async () => { | ||
const response = await fetch(`${BASEURL}?f=get_email_address`); | ||
const response_json = await response.json(); | ||
const credentials = JSON.parse(readFileSync("config.json", "utf8")); | ||
credentials.email = response_json.email_addr; | ||
credentials.sid_token = response_json.sid_token; | ||
writeFile("config.json", JSON.stringify(credentials), function (err) { | ||
if (err) { | ||
console.log(err); | ||
} | ||
}); | ||
return { | ||
email: response_json.email_addr, | ||
sid_token: response_json.sid_token, | ||
alias: response_json.alias, | ||
email_timestamp: response_json.email_timestamp | ||
}; | ||
}; | ||
const getEmailList = async (sid_token) => { | ||
const response = await fetch(`${BASEURL}?f=get_email_list&offset=0&sid_token=${sid_token}`); | ||
const response_json = await response.json(); | ||
return { | ||
list: response_json.list, | ||
}; | ||
}; | ||
const getLatestEmail = async (sid_token) => { | ||
let emailList = await getEmailList(sid_token); | ||
let emailListLength = emailList.list.length; | ||
while (true) { | ||
await new Promise(r => setTimeout(r, 10000)); | ||
emailList = await getEmailList(sid_token); | ||
emailListLength = emailList.list.length; | ||
if (emailListLength > 1) { | ||
break; | ||
} | ||
} | ||
return emailList.list[0]; | ||
}; | ||
const getPoeOTPCode = async (sid_token) => { | ||
const emailData = await getLatestEmail(sid_token); | ||
// Example email subject: "Your verification code 123456" | ||
console.log("OTP CODE: " + emailData.mail_subject.split(' ')[3]); | ||
return emailData.mail_subject.split(' ')[3]; | ||
}; | ||
export { createNewEmail, getEmailList, getLatestEmail, getPoeOTPCode }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mutation SignupWithVerificationCodeMutation( | ||
$verificationCode: String! | ||
$emailAddress: String | ||
$phoneNumber: String | ||
) { | ||
signupWithVerificationCode( | ||
verificationCode: $verificationCode | ||
emailAddress: $emailAddress | ||
phoneNumber: $phoneNumber | ||
) { | ||
status | ||
} | ||
} |
Oops, something went wrong.