THE WAY WE WORK

Our API is really simple but secure.

HOW

To use our API you only need a working website. You may have a login or signup page and you want to make it more secure and easy for most people.

This is a simple way to use our API:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Signup</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #f4f4f9;
        }
        #signup-form {
            display: none;
            margin-top: 20px;
        }
        .error-message {
            color: red;
            margin-top: 10px;
            display: none;
        }
        button, input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            cursor: pointer;
            border-radius: 5px;
            font-size: 16px;
        }
        button:hover, input[type="submit"]:hover {
            background-color: #45a049;
        }
        input {
            margin: 10px 0;
            padding: 10px;
            width: 100%;
            box-sizing: border-box;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        .container {
            max-width: 300px;
            width: 100%;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="container">
        <button id="verify-button">Verify</button>
        <p id="error-message" class="error-message"></p>

        <form id="signup-form" action="/signup" method="POST">
            <h2>Signup</h2>
            <input type="text" name="username" placeholder="Username" required>
            <input type="email" name="email" placeholder="Email" required>
            <input type="password" name="password" placeholder="Password" required>
            <input type="submit" value="Signup">
        </form>
    </div>

    <script>
        document.getElementById('verify-button').addEventListener('click', function () {
            window.location.href = 'https://rhv.pages.dev?redirect=myweb.com/signup';
        });
    
        const params = new URLSearchParams(window.location.search);
        const vid = params.get('vid');
        const errorMessage = document.getElementById('error-message');
    
        if (vid && !isNaN(vid)) {
            fetch('https://rhv.htdevs.workers.dev/verify-id', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({ id: vid }),
            })
            .then(response => {
                if (!response.ok) {
                    return response.json().then(errData => {
                        throw new Error(errData.message || 'Unknown error occurred');
                    });
                }
                return response.json();
            })
            .then(data => {
                console.log('Server Response:', data);
                console.log('vid:', vid);
                    document.getElementById('signup-form').style.display = 'block';
                    document.getElementById('verify-button').style.display = 'none';
                    errorMessage.style.display = 'none';
            })
            .catch(error => {
                errorMessage.textContent = error.message;
                errorMessage.style.display = 'block';
                console.error('Error during verification:', error);
            });
        } else {
            errorMessage.textContent = 'Invalid or non-numeric vid';
            errorMessage.style.display = 'block';
        }
    </script>      
</body>
</html>

Last updated