Skip to content
uencoder

CORS Credentials

CORS credentials control whether cross-origin requests carry cookies and HTTP authentication; both the client and the server must explicitly opt in.

Purpose

It safely governs the transmission of cookies and authentication headers in cross-origin requests, preventing cross-origin credential leakage.

Mechanism

The client sets fetch credentials: "include"; the server returns Access-Control-Allow-Credentials: true, and Allow-Origin must be a specific value (not *). Only same-origin requests carry credentials by default.

Use cases

  • Cross-origin requests with cookies
  • Cross-domain SSO authentication
  • Cross-origin API sessions

Related tools

References