MsgAuth
Save up to 98% on phone
number verification
Benefit from many providers at once: Telegram, WhatsApp, etc
Automatically select the cheapest one for user's phone number
Benefit from many providers at once: Telegram, WhatsApp, etc
Automatically select the cheapest
one for user's phone number
import { MsgAuth } from "msg-auth";
try {
const msgAuth = new MsgAuth('api_key');
const result = await msgAuth.sendCheapestMessage(phoneNumber);
switch (result.strategy) {
case 'cheap':
console.log('Message sent successfully via cheapest method (telegram/whatsapp/other sms provider)!');
const code = prompt('Enter the verification code sent to your phone:');
const token = await result.confirm(code);
await signInWithCustomTokenFirebase(token);
break;
case 'fallback':
console.log('Fallback to Firebase for phone number authentication because it's cheaper for that country code.');
await signInWithPhoneNumberFirebase(phoneNumber);
break;
default:
throw new Error(`Unexpected strategy: ${result.strategy}`);
}
} catch (error) {
console.error('An error occurred during the authentication process:', error.message);
}
import { MsgAuth } from "msg-auth";
try {
const msgAuth = new MsgAuth('api_key');
const result = await msgAuth.sendCheapestMessage(phoneNumber);
switch (result.strategy) {
case 'cheap':
console.log('Message sent successfully via cheapest method (telegram/whatsapp/other sms provider)!');
const code = prompt('Enter the verification code sent to your phone:');
const token = await result.confirm(code);
await signInWithCustomTokenFirebase(token);
break;
case 'fallback':
console.log('Fallback to Firebase for phone number authentication because it's cheaper for that country code.');
await signInWithPhoneNumberFirebase(phoneNumber);
break;
default:
throw new Error(`Unexpected strategy: ${result.strategy}`);
}
} catch (error) {
console.error('An error occurred during the authentication process:', error.message);
}
Easy to integrate
on top of existing solution
Easy to integrate
on top of existing solution
Fallback for free if user has no account in cheaper providers
Fallback for free if user has no account in cheaper providers
2024 MsgAuth
MsgAuth