# Login

### Overview

The login page provides the buyer authentication entry point for the storefront experience.

Salesforce Commerce supports multiple authentication and login integration patterns. Select the approach that best aligns with your organization's security, identity management, and domain requirements.

This flow demonstrates how a headless storefront can orchestrate custom Apex-based authentication experiences for buyer access and session management.

![Login Overview Flow](https://a.sfdcstatic.com/developer-website/sfdocs/commerce-cloud/media/d2c-commerce/b2b-headless-b2b-commerce-headless-flow-orchestration-login-overview-30-1.png "Login Overview Flow")

**Authentication Approach**

Choose OAuth-based authentication when integrating with external identity providers (IdPs), mobile applications, or workflows that require refresh token support.

### B2B Commerce APIs Used in the Flow

**OAuth**

| Operation       | HTTP Method | Endpoint                     |
| --------------- | ----------- | ---------------------------- |
| OAuth authorize | GET         | `/services/oauth2/authorize` |
| OAuth token     | POST        | `/services/oauth2/token`     |

### Buyer Journey

**Authentication with OAuth**

Use an OAuth-based authentication flow to integrate with an external Identity Provider (IdP). After the buyer session is established, storefront operations are decoupled from the underlying authentication mechanism and rely solely on the active session.

See [Authorization Through External Client Apps or Connected Apps and OAuth 2.0 and Authorize Apps with OAuth](https://help.salesforce.com/s/articleView?id=xcloud.remoteaccess_authenticate.htm\&type=5) for more information.
