Getting 503 error in Firebase phone authentication

2,030 views
Skip to first unread message

Syed Kashif Ali

unread,
Oct 27, 2023, 12:54:06 PM10/27/23
to Firebase Google Group
Hello all,
I am a newbie to Firebase. Getting error 'Failed to load resource error: the server responded with a status of 503 () https://www.googleapis.com/identitytoolkit/v3/relyingparty/sendVerificationCode?key=mykey' when try send OTP using Firebase phone authentication  method. Shall be very thankful if someone could help. 

Below is the detailed error message.
{"error":{"code":503,"message":"Error code: 39","errors":[{"message":"Error code: 39","domain":"global","reason":"backendError"}]}}

Here is my code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test</title>
</head>
<body>
    <div class="row mt-3">
        <form>
            <h3>Enter phone no</h3>
            <input type="text" id="number" value="enter verification">
            <button type="button" value="Submit" onclick="phoneAuth();">Send Code</button>
        </form>
    </div>
    <div class="row mt-3" id="recaptcha-container"></div>
    <div class="row mt-3">
        <form>
            <h3>Enter OTP</h3>
            <input type="text" id="verificationCode" value="enter OTP">
            <button type="button" value="Submit" onclick="codeverify();">Verify OTP</button>
        </form>
    </div>

    <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-auth.js"></script>
    <script>
        var config = {
            apiKey: "mykey",
            authDomain: "xxxxxx",            
            projectId: "XXXX",
            storageBucket: "XXXX",
            messagingSenderId: "XXXX",
            appId: "XXXX"
        };
        firebase.initializeApp(config);
    </script>
    <script>
        window.onload = function () {
            render();
        };

        function render() {
            window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
            recaptchaVerifier.render();
        }
         
        // Function for phone authentication
        function phoneAuth() {
            var number = "+92" + document.getElementById('number').value;
            firebase.auth().signInWithPhoneNumber(number, recaptchaVerifier)
                .then(function (confirmationResult) {
                    window.confirmationResult = confirmationResult;
                    console.log(confirmationResult);
                    alert("Message Sent");
                })
                .catch(function (error) {
                    console.error(error);
                    alert(error.message);
                });
        }
        // Function for verifying the code
        function codeVerify() {
            var code = document.getElementById('verificationCode').value;
            confirmationResult.confirm(code)
                .then(function (result) {
                    alert("Message Verified");
                    var user = result.user;
                    console.log(user);
                    //window.location.href = "/index/registration";
                })
                .catch(function (error) {
                    console.error(error);
                    alert(error.message);
                });
        }
    </script>
</body>
</html>

Please tell what i am doing wrong or what do i need to do in my firebase project/service settings in the backend to remove this error.
Shall be very thankful.
 
Kashif

Joshua Aruokhai

unread,
Oct 30, 2023, 2:18:34 PM10/30/23
to Firebase Google Group

It seems, there is a quota issue, i guess you have exhausted your quota limit, you can verify if that is the case

usama safi

unread,
Oct 31, 2023, 5:09:30 PM10/31/23
to Firebase Google Group
I too got the Error:  "Error code: 39", and on a created test number everything work, but not on a real mobile number.
I've checked the quota limits and none of them are over the threshold.

I guess some kind of update to Authentication service from Firebase did that.
I've sent a message to support, waiting for a reply.

Syed Kashif Ali

unread,
Oct 31, 2023, 5:09:30 PM10/31/23
to Firebase Google Group
Yes, you are right Joshua. The issue is related to quota that expired during testing. Got the same error when i used the Firebase web modular API for phone authentication. If i whitelist a phone number by
entering it into ficticious numbers, i don't get an error. 

Stony Flavor

unread,
Oct 31, 2023, 8:35:59 PM10/31/23
to fireba...@googlegroups.com
Mobile has two authentication #s

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/d0b4698b-f3fa-4f8a-8d2a-f618ca3f7caan%40googlegroups.com.

Syed Kashif Ali

unread,
Nov 3, 2023, 1:32:03 PM11/3/23
to Firebase Google Group
Hi, 
My issue resolved which was related to Firebase blacklisting a cell number due to accessive testing that i did to test the code. I used a new number and OPT sent out successfully. 
Thank you,
Ali
Reply all
Reply to author
Forward
0 new messages