How to send firebase auth sms in php?

Viewed 53

I want to send auth messages to users using PHP but firebase performs this function on the client-side only (e.g. Javascript). In javascript, I was able to write the following code

var phoneNumber = 'xxxxxxxxxxxxxxxx';
var appVerifier = window.recaptchaVerifier;
firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)
.then(function(confirmationResult) {

    console.log(confirmationResult);

}).catch(function(error) {

    console.log(error);

});

This code works just fine and sends the verification code (OTP) to the user successfully. But my requirement is to perform this task using PHP. How can I do that? How can I include required firebase files and then how can I run this javascript (or similar) code in PHP? Is there any way like creating REST APIs or something similar.

0 Answers
Related