Не найдено соответствие хоста. Google firebase messaging
Сообщение об ошибке hostmatch not found Я создаю uber-подобное приложение для доставки, используя django. Я только что реализовал firebase messaging, но каждый раз, когда я пытаюсь добавить номер телефона, чтобы он отправил проверочный код, он выдает ошибку "Hostmatch not foundFirebase Configs", поэтому, пожалуйста, у кого-нибудь есть идея, как я могу это решить. Я пробовал белую книгу, это ничего не изменило, или может это мой код.
`
Номер телефона
<div id="recaptcha-container"></div>
<div id="get-code" class="input-group mb-3 {% if request.user.customer.phone_number %} d-none {% endif %}">
<label>
<input type="text" class="form-control" placeholder="Your phone number">
</label>
<div class="input-group-append">
<button class="btn btn-warning" type="button">Send code</button>
</div>
</div>
<div id="verify-code" class="input-group mb-3 d-none">
<label>
<input type="text" class="form-control" placeholder="Verification code">
</label>
<div class="input-group-append">
<button class="btn btn-success" type="button">Verify code</button>
</div>
</div>
<div id="change-phone"
class="input-group mb-3 {% if not request.user.customer.phone_number %} d-none {% endif %}">
<label>
<input type="text" class="form-control" disabled value="{{ requeat.user.customer.phone_number }}">
</label>
<div class="input-group-append">
<button class="btn btn-warning" type="button">Change</button>
</div>
</div>
</div>
function onVerify(idToken) {
var form = document.createElement("form");
form.method = "POST";
var element1 = document.createElement("input");
element1.name = "id_token";
element1.value = idToken;
form.appendChild(element1);
var element2 = document.createElement("input");
element2.name = "action";
element2.value = "update_phone";
form.appendChild(element2);
var element3 = document.createElement("input");
element3.name = "csrfmiddlewaretoken";
element3.value = "{{ csrf_token }}";
form.appendChild(element3);
document.body.appendChild(form);
form.submit();
}
window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container', {
'size': 'invisible'
});
$("#get-code button").on('click', function () {
const phoneNumber = $("#get-code input").val();
console.log(phoneNumber);
firebase.auth().signInWithPhoneNumber(phoneNumber, window.recaptchaVerifier)
.then((confirmationResult) => {
// SMS отправлено. Предложите пользователю ввести код из сообщения, а затем подпишите пользователя.
// пользователя с помощью confirmationResult.confirm(code).
console.log(confirmationResult);
window.confirmationResult = confirmationResult;
$("#get-code").addClass("d-none");
$("#verify-code").removeClass("d-none");
}).catch((error) => {
// Ошибка; SMS не отправлено
toast(error.message, 'error');
});
});
$("#verify-code button").on('click', function () {
const code = $("#verify-code input").val();
confirmationResult.confirm(code).then((result) => {
// Пользователь успешно вошел в систему.
const user = result.user;
console.log(user.phoneNumber);
user.getIdToken().then(function (idToken) {
onVerify(idToken);
});
}).catch((error) => {
// Пользователь не смог войти в систему (плохой проверочный код?)
toast(error.message, 'error');
});
});
$("#change-phone button").on('click', function () {
$("#change-phone").addClass("d-none");
$("#get-code").removeClass("d-none");
})
`