requestMagicLink (auth.go)

clickclack · apps/api/internal/httpapi/auth.go · go · MIT
auth, Auth / Identity, integration, email, tag:passwordless-auth, tag:cookie-setting

Serves magic link issuance, parses email from POST /magic-link, sets cookie via setMode. Maybe handle? Ensure. Could say: "Handles POST /magic-link auth, emails magic link, sets session cookie." Check code truncated but likely. Output: "Handles magic link request: POST, parses email, issues magic link, sets auth cookie." Keep terse.

// Source: https://github.com/openclaw/clickclack | License: MIT | Copyright 2026 openclaw
// Provided via justclaw.it.com; keep this notice with the code.
package httpapi

import (
	"context"
	"database/sql"
	"errors"
	"mime"
	"net"
	"net/http"
	"net/url"
	"strconv"
	"strings"

	"github.com/openclaw/clickclack/apps/api/internal/passwordauth"
	"github.com/openclaw/clickclack/apps/api/internal/store"
)

type magicLinkResponse struct {
	ID          string  `json:"id"`
	Email       string  `json:"email"`
	DisplayName string  `json:"display_name"`
	CreatedAt   string  `json:"created_at"`
	ExpiresAt   string  `json:"expires_at"`
	UsedAt      *string `json:"used_at,omitempty"`
}

func (s *Server) requestMagicLink(w http.ResponseWriter, r *http.Request) {
	if s.disableDevAuth {
		writeError(w, ht

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key