@alexstrnik/multifactor-cli
Version:
CLI tool for bypassing multifactor authentication
30 lines (29 loc) • 864 B
JavaScript
import fetch from "node-fetch";
export async function register(fcmRegistration) {
const deviceSettings = [
{
transportKind: "Fcm",
deviceToken: fcmRegistration.token,
},
];
try {
const response = await fetch("https://sub.multipushed.ru/v2/tokens", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
clientToken: "",
deviceSettings,
}),
});
const pushedResult = (await response.json());
if (!pushedResult.success) {
throw new Error(`Failed to register with multipushed: ${pushedResult.message || pushedResult.errCode}`);
}
return pushedResult.model;
}
catch (error) {
throw error;
}
}