Skip to main content

signup

Register a new user account. Sends a verification email to the provided address.

Input Parameters

email
string
required
Valid email address (5-40 characters)
password
string
required
Password (8-24 characters). Must contain:
  • At least one uppercase letter
  • At least one lowercase letter
  • At least one number
  • At least one special character (!@#$%^&*()_+-=[];’:”|,.<>/?)

Response

message
string
Confirmation message asking user to check their email
email
string
The email address that was registered
const result = await trpc.user.signup.mutate({
  email: "user@example.com",
  password: "SecurePass123!"
});

console.log(result.message); // "Please check your email to verify your account"

verifyEmail

Verify a user’s email address using the token sent via email.

Input Parameters

token
string
required
Verification token from the email

Response

token
string
JWT authentication token (expires in 1 hour)
const result = await trpc.user.verifyEmail.mutate({
  token: "verification-token-from-email"
});

console.log(result.token); // JWT token

resendVerification

Resend the email verification link to a user.

Input Parameters

email
string
required
Email address to resend verification to

Response

message
string
Confirmation message (doesn’t reveal if account exists for security)
const result = await trpc.user.resendVerification.mutate({
  email: "user@example.com"
});

login

Authenticate with email and password.

Input Parameters

email
string
required
User’s email address
password
string
required
User’s password

Response

token
string
JWT authentication token (expires in 1 hour)
const result = await trpc.user.login.mutate({
  email: "user@example.com",
  password: "SecurePass123!"
});

console.log(result.token);

Error Codes

  • NOT_FOUND - User not found or invalid credentials
  • FORBIDDEN - Email not verified yet
  • UNAUTHORIZED - Invalid password

githubAuth

Authenticate using GitHub OAuth.

Input Parameters

code
string
required
Authorization code from GitHub OAuth flow
state
string
Optional state parameter for CSRF protection

Response

token
string
JWT authentication token (expires in 1 hour)
const result = await trpc.user.githubAuth.mutate({
  code: "github-oauth-code",
  state: "csrf-token"
});

console.log(result.token);

me

Get the authenticated user’s profile information.
This endpoint requires authentication.

Response

id
string
User’s unique identifier
email
string | null
User’s email address
name
string | null
User’s display name
avatarUrl
string | null
URL to user’s avatar image
const user = await trpc.user.me.query();

console.log(user.email);

Build docs developers (and LLMs) love