# Request: credentials property



The **`credentials`** read-only property of the [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) interface reflects the value given to the [Request()](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request) constructor in the [`credentials`](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#credentials) option. It determines whether or not the browser sends credentials with the request, as well as whether any **`Set-Cookie`** response headers are respected.

Credentials are cookies, [TLS](https://developer.mozilla.org/en-US/docs/Glossary/TLS) client certificates, or authentication headers containing a username and password.

See [Including credentials](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#including_credentials) for more details.

## Value

A string with one of the following values:

- `omit`
  - : Never send credentials in the request or include credentials in the response.
- `same-origin`
  - : Only send and include credentials for same-origin requests.
    This is the default.
- `include`
  - : Always include credentials, even for cross-origin requests.

## Examples

In the following snippet, we create a new request using the [Request()](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request) constructor (for an image file in the same directory as the script), then save the request credentials in a variable:

```js
const request = new Request("flowers.jpg");
const credentials = request.credentials; // returns "same-origin" by default
```

## Specifications

## Browser compatibility

## See also

- [ServiceWorker API](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)
- [HTTP access control (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS)
- [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP)
