Skip to content

User Authentication with Credentials (Email and Password)

LaunchFa.st uses in house simple as heck server-side first Credentials (Email & Password) authentication to help you authenticate users easily with Upstash.

You can configure it in the src/pages/api/sign folder.
  1. Update the .env file or hosting provider’s environment variable to have the necessary variables for Upstash:
# Obtained from Upstash Console
# https://upstash.com/docs/redis/howto/connectclient#database

UPSTASH_REDIS_REST_URL="https://....upstash.io"
UPSTASH_REDIS_REST_TOKEN="...."
  1. To simply authenticate users via credentials (email and password), make a HTML form POSTing to the sign in/up APIs. Here’s how you’d create a simple form in each framework:
---
// File: src/pages/signin.astro
---

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
  </head>
  <body>
    <form action="/api/sign/in" method="POST">
      <div>
        <label for="email">Email address</label>
        <input
          required
          id="email"
          name="email"
          type="email"
          autocomplete="email"
        />
      </div>
      <div>
        <label for="password">Password</label>
        <input
          required
          id="password"
          name="password"
          type="password"
          autocomplete="current-password"
        />
      </div>
      <button type="submit">
        Sign in
      </button>
    </form>
  </body>
</html>