Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

b2c-slas-auth-patterns

БесплатноБез исполняемых скриптовНе проверен

Implement SLAS authentication patterns in B2C Commerce including passwordless login (email OTP, SMS OTP, passkeys), session bridging between PWA…

SalesforceCommerceCloudот SalesforceCommerceCloud★ 58 звёзд на GitHub

Об этом скилле

B2C SLAS Authentication Patterns

Advanced authentication patterns for SLAS (Shopper Login and API Access Service) beyond basic login. These patterns enable passwordless authentication, hybrid storefront support, and system-to-system integration.

Scope & grounding

This skill covers SLAS authentication patterns including passwordless login (email OTP, SMS, passkeys), session bridging, hybrid authentication (B2C 25.3+), token management, TSOB, and JWT validation with framework-specific examples for PWA Kit, Storefront Next, and SFRA. Code examples are illustrative of typical flows. Before answering version-specific questions, framework-specific implementations, or providing code the user will run in production, confirm current API contracts, parameters, rate limits, and version requirements against the official documentation via b2c docs search and b2c docs read. The canonical docs are the authoritative source for B2C platform specifics, API shapes, and configuration requirements.

Canonical docs

  • commerce-api/slas - SLAS overview
  • commerce-api/slas-best-practices - Security and implementation best practices
  • commerce-api/slas-passwordless-login-overview - Passwordless authentication overview
  • commerce-api/slas-passwordless-login-email - Email OTP implementation
  • commerce-api/slas-passwordless-login-passkey - Passkey/WebAuthn implementation
  • commerce-api/slas-passwordless-sms - SMS OTP implementation
  • commerce-api/slas-session-bridge-overview - Session bridge overview
  • commerce-api/slas-session-bridge-auth - Session bridge implementation
  • commerce-api/hybrid-authentication - Hybrid authentication (B2C 25.3+)
  • commerce-api/hybrid-auth-pwa-kit-v2 - PWA Kit v2 hybrid auth
  • pwa-kit-managed-runtime/hybrid-auth - PWA Kit managed runtime hybrid auth
  • pwa-kit-managed-runtime/plugin-slas-setup - Plugin SLAS setup
  • commerce-api/slas-trusted-system - Trusted system on behalf (TSOB)
  • commerce-api/slas-public-client - Public client configuration
  • commerce-api/slas-private-client - Private client configuration
  • commerce-api/slas-validate-jwt-with-jwks - JWT validation

Authentication Methods Overview

Method Use Case User Experience
Password Traditional login Username + password form
Email OTP Passwordless email Code sent to email
SMS OTP Passwordless SMS Code sent to phone
Passkeys FIDO2/WebAuthn Biometric or device PIN
Session Bridge Hybrid storefronts Seamless PWA ↔ SFRA
Hybrid Auth B2C 25.3+ Built-in platform auth sync
TSOB System integration Backend service calls

Passwordless Email OTP

Illustrative of the flow; confirm current API shape, parameters, and rate limits with b2c docs read commerce-api/slas-passwordless-login-email and b2c docs read commerce-api/slas-passwordless-login-overview.

Send one-time passwords via email for passwordless login.

Flow Overview

  1. Call /oauth2/passwordless/login with callback URI
  2. SLAS POSTs pwdless_login_token to your callback
  3. Your app sends OTP to shopper via email
  4. Shopper enters OTP, app exchanges for tokens

Step 1: Initiate Passwordless Login

// POST /shopper/auth/v1/organizations/{org}/oauth2/passwordless/login
async function initiatePasswordlessLogin(email, siteId) {
    const response = await fetch(
        `https://${shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/${orgId}/oauth2/passwordless/login`,
        {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            body: new URLSearchParams({
                user_id: email,
                mode: 'callback',
                channel_id: siteId,
                callback_uri: 'https://yoursite.com/api/passwordless/callback'
            })
        }
    );

    // SLAS will POST to your callback_uri with pwdless_login_token
    return response.json();
}

Step 2: Handle Callback and Send OTP

Your callback endpoint receives pwdless_login_token. Generate an OTP and send it to the user:

// Your callback endpoint (receives POST from SLAS)
app.post('/api/passwordless/callback', async (req, res) => {
    const { pwdless_login_token, user_id } = req.body;

    // Generate 6-digit OTP
    const otp = Math.floor(100000 + Math.random() * 900000).toString();

    // Store token + OTP mapping (e.g., Redis with 10 min TTL)
    await redis.setex(`pwdless:${otp}`, 600, JSON.stringify({
        token: pwdless_login_token,
        email: user_id
    }));

    // Send OTP via email (configure in SLAS Admin UI)
    await sendOTPEmail(user_id, otp);

    res.status(200).send('OK');
});

Step 3: Exchange OTP for Tokens

// POST /shopper/auth/v1/organizations/{org}/oauth2/passwordless/token
async function exchangeOTPForToken(otp, clientId, clientSecret, siteId) {
    // Retriev
Полный SKILL.md на GitHub

Установить b2c-slas-auth-patterns в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/trigger-evals.jsonreferences/PASSKEYS.mdreferences/SESSION-BRIDGE.mdreferences/TOKEN-LIFECYCLE.md

FAQ

Что делает скилл b2c-slas-auth-patterns?

Implement SLAS authentication patterns in B2C Commerce including passwordless login (email OTP, SMS OTP, passkeys), session bridging between PWA Kit/Storefront Next and SFRA, hybrid authentication (B2C 25.3+), token refresh flows, trusted system on behalf of (TSOB), and JWT validation. Use this skill whenever the user asks about shopper authentication beyond basic login, token exchange flows, passwordless or biometric auth, keeping sessions alive across storefronts, handling 409 Conflict errors on token endpoints, refreshing shopper tokens, or validating JWTs — even if they don't mention SLAS by name.

Как установить скилл b2c-slas-auth-patterns?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл b2c-slas-auth-patterns запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить b2c-slas-auth-patterns с