Confirmation Email not work

Hello everyone. I found a script on the forum confirming user registration.

From the application level, everything works, registration is successful. The email is sent. Clicking on the confirmation of registration does not work, and I have to confirm the account in mongoDB myself. What should I do?

<script src=""></script>
const APP_ID = "application-0-qqusr";
const app = new Realm.App({ id: APP_ID});
//Grab Tokens
const params = new URLSearchParams(;
const token = params.get('token');
const tokenId = params.get('tokenId');
//Confirm client
    .confirmUser(token, tokenId)
    .then(() => displayResult('success'))
    .catch(err => displayResult('error', err))
//Display Message depending on result
function displayResult(result, err) {
    const message = document.getElementById("message");
    if (result === "success") {
        message.innerText = "Your E-mail address has been verified.\n\n You may close this page. Thank you.";
   else if (result === "error") {
       message.innerText = "Unable to register this user. Please try again to register." + err;

<title>E-mail Confirmation</title>
    h1 {text-align: center;}
    h3 {text-align: center;}
    h5 {text-align: center; background-color: whitesmoke;}
    p {text-align: center;}
    div {text-align: center;}
    <h1>My Apps Name</h1>
    <h3>Thanks for choosing our app!</h1>
    <h5 id = "message"></h5>