# Custom Nakama Web Client

**URL:** <https://forum.heroiclabs.com/t/custom-nakama-web-client/5989>\
**Category:** Client Libraries\
**Tags:** authentication\
**Created:** [February 2, 2025, 10:37pm UTC](https://forum.heroiclabs.com/t/custom-nakama-web-client/5989 "2025-02-02T22:37:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EarthAdam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/earthadam/32/259_2.png) [@EarthAdam](https://forum.heroiclabs.com/u/EarthAdam)\
**Post date:** [February 2, 2025, 10:37pm UTC](https://forum.heroiclabs.com/t/custom-nakama-web-client/5989/1 "2025-02-02T22:37:26Z")

</div>

I’ve had a Nakama game server running on a Postgres database for years now. I want to integrate 3rd-party integrations into my app that I built in Unity (i.e. Garmin), and I want to do this via a web-portal since Unity is not good for building OAuth workflows. So far I’ve been using Zapier but that can get pricey. Is there an example of a vanilla js HTML page that integrates properly with the server? I just need to let the user login, and query and update their storage collection. Here’s my attempt so far, but it keeps saying: “Uncaught ReferenceError: nakama is not defined” and same for nakamajs when I try those iterations. And yes I configure my own host IP address.

```auto
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Nakama Login</title>
</head>
<body>
  <!-- Simple Login Form -->
  <form id="loginForm">
    <input type="email" id="email" placeholder="Email" required>
    <input type="password" id="password" placeholder="Password" required>
    <button type="submit">Login</button>
  </form>
  <div id="result"></div>

  <!-- Include the UMD build of the Nakama client library -->
  <script src="https://unpkg.com/@heroiclabs/nakama-js/dist/nakama.min.js"></script>
  <script>
    // Create a Nakama client instance.
    // Replace "defaultkey", "IP_ADDRESS", and "7350" with your configuration.
    const client = new Nakama.Client("defaultkey", "IP_ADDRESS", "7350", false);

    // Listen for the form submission and authenticate the user.
    document.getElementById("loginForm").addEventListener("submit", async function(e) {
      e.preventDefault();
      const email = document.getElementById("email").value;
      const password = document.getElementById("password").value;
      const resultDiv = document.getElementById("result");

      try {
        const session = await client.authenticateEmail(email, password, false);
        resultDiv.textContent = "Login successful! Session token: " + session.token;
      } catch (err) {
        resultDiv.textContent = "Login failed: " + (err.message || err);
      }
    });
  </script>
</body>
</html>
```

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [February 3, 2025, 2:40pm UTC](https://forum.heroiclabs.com/t/custom-nakama-web-client/5989/2 "2025-02-03T14:40:24Z")

</div>

Hello @EarthAdam,

From the error, it seems like the Nakama client js file is not being resolved correctly.

I don’t think we have the exact example you’re asking for, but have you tried following the example here: [JavaScript - Heroic Labs Documentation](https://heroiclabs.com/docs/nakama/client-libraries/javascript/index.html#installation) ?

Best.
