Available Authentication Methods

Prism Auth supports multiple authentication methods to handle various login scenarios across different websites.

Password Authentication

Standard username/password authentication for most websites. Username and password are required.
{
  "domain": "https://github.com/login",
  "loginMethod": "password",
  "cred": {
    "username": "user@example.com",
    "password": "userPassword123"
  }
}

OTP Email Authentication

One-Time Password authentication via email. This method automatically handles email-based verification codes. Email is required, username and password are optional.
{
  "domain": "https://example.com/login",
  "loginMethod": "otp_email",
  "cred": {
    "email": "user@example.com"
  }
}
You can also include username and password if needed:
{
  "domain": "https://example.com/login",
  "loginMethod": "otp_email",
  "cred": {
    "email": "user@example.com",
    "username": "user@example.com",
    "password": "userPassword123"
  }
}
Passwordless authentication via magic link sent to email. This method automatically handles email-based magic link flows. Email is required, username and password are optional.
{
  "domain": "https://example.com/login",
  "loginMethod": "magic_link",
  "cred": {
    "email": "user@example.com"
  }
}
You can also include username and password if the website supports additional authentication factors:
{
  "domain": "https://example.com/login",
  "loginMethod": "magic_link",
  "cred": {
    "email": "user@example.com",
    "username": "user@example.com",
    "password": "userPassword123"
  }
}

Email Forwarding Setup for Email-Based Authentication

To use OTP email or magic link authentication, you’ll need to set up email forwarding so Prism Auth can access verification codes or magic links sent to your email address.

Gmail Forwarding Setup

Follow these steps to forward OTP emails from your Gmail account:

1. Add the Forwarding Address

  1. Open Gmail and click the Settings gear ⚙️ in the top-right corner
  2. Click See all settings
  3. Go to the Forwarding and POP/IMAP tab
  4. In the “Forwarding” section, click Add a forwarding address
  5. Enter prismauth@agentmail.to and click NextProceedOK
  6. Google will send a confirmation code to prismauth@agentmail.to
  7. You will need to access this email address to get the confirmation code
  8. Enter the code in Gmail to verify the forwarding address

2. Create a Filter to Forward Specific Emails

  1. In Gmail, click the Show search options icon in the search bar (it looks like three sliders)
  2. In the “From” field, enter: no-reply@example.com (replace with the actual sender)
  3. Click Create filter
  4. Check the option Forward it to, then select prismauth@agentmail.to from the dropdown
  5. Click Create filter
Replace no-reply@example.com with the actual email address that sends OTP codes from your target website.

Generic Example Setup

Here’s a complete example for setting up OTP email authentication with a generic service:
// Step 1: Set up email forwarding (done once)
// Follow the Gmail setup steps above

// Step 2: Use email-based authentication (email required, username/password optional)

// Option A: OTP Email Authentication
const otpResponse = await fetch("https://prismai.sh/api/login", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.PRISM_AUTH_API_KEY}`,
  },
  body: JSON.stringify({
    domain: "https://myservice.com/login",
    loginMethod: "otp_email",
    cred: {
      email: "user@example.com", // Email is required
      // username and password are optional
    },
  }),
});

// Option B: Magic Link Authentication
const magicLinkResponse = await fetch("https://prismai.sh/api/login", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.PRISM_AUTH_API_KEY}`,
  },
  body: JSON.stringify({
    domain: "https://myservice.com/login",
    loginMethod: "magic_link",
    cred: {
      email: "user@example.com", // Email is required
      // username and password are optional
    },
  }),
});

// Use either response depending on which method you chose
const { cookies } = await otpResponse.json(); // or magicLinkResponse.json()

// Step 3: Apply cookies to your browser
cookies.forEach((cookie) => {
  browser.setCookie(cookie);
});

Coming Soon

The following authentication methods are in development:
  • OAuth Google (oauth_google) - Google OAuth flow
  • OAuth GitHub (oauth_github) - GitHub OAuth flow
  • OTP SMS (otp_sms) - SMS one-time password
  • TOTP (totp) - Time-based authenticator app tokens
Only password, otp_email, and magic_link authentication methods are currently available. Using other methods will return an error.