---
title: Set Custom Cookie node
description: Store an additional custom cookie on the client.
component: auth-node-ref
version: 7.3
page_id: auth-node-ref::auth-node-set-custom-cookie
canonical_url: https://docs.pingidentity.com/auth-node-ref/latest/set-custom-cookie.html
llms_txt: https://docs.pingidentity.com/auth-node-ref/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
section_ids:
  outcomes: Outcomes
  properties: Properties
  example: Example
---

# Set Custom Cookie node

Store an additional custom cookie on the client.

This node uses the specified properties to create a cookie with a custom name and value, and optionally, sets attributes such as the cookie path, domain, expiry, and security flags.

You can use this node with the [Configuration Provider node](auth-node-config-provider.html) to extend custom capabilities. For instance, create a `Config Provider` script to set custom static values or access values from the shared node state.

Include all the attributes in the configuration provider script's `config` map. The following example sets the attributes of the custom cookie to static values:

```javascript
config = {
    "name": "testname",
    "value": "testvalue",
    "maxAge": "60",
    "domain": "am.example.com",
    "path": "/",
    "useSecureCookie": false,
    "useHttpOnlyCookie": false,
    "sameSite": "LAX"
};
```

Reference the script when you create a [Configuration Provider node](auth-node-config-provider.html), and set the Node Type to `Set Custom Cookie`:

![Configuration Provider node referencing this node](_images/node-set-custom-cookie-config-provider.png)

## Outcomes

Single outcome path.

The cookie is created when AM next returns to the client.

## Properties

| Property                         | Usage                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Custom Cookie Name *(required)*  | Sets the name of the custom cookie.The cookie name can contain any US-ASCII characters except for: space, tab, control, or a separator character (`()<>@,;:"/[]?=\{}`).                                                                                                                                                                                                                                                                                                                    |
| Custom Cookie Value *(required)* | Sets the value of the custom cookie.                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Max Age                          | Specifies the length of time the custom cookie remains valid, in seconds. If that time is exceeded, the cookie is no longer valid.Both the `Max-Age` and `Expires` attributes are set in the cookie to increase compatibility with different browsers.If omitted, the cookie expires at the end of the current session. The precise implementation of this is determined by the specific browser. Refer to [RFC 6265](https://www.rfc-editor.org/rfc/rfc6265#section-4.1.2.2) for details. |
| Custom Cookie Domain             | Sets the domain that the custom cookie will be sent to.                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Custom Cookie Path               | Sets the path of the custom cookie.                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Use Secure Cookie                | When enabled, adds the `Secure` flag to the custom cookie.If the `Secure` flag is included, the cookie can only be transferred over HTTPS. When a request is made over HTTP, the cookie is not made available to the application.                                                                                                                                                                                                                                                          |
| Use HTTP Only Cookie             | When enabled, adds the `HttpOnly` flag to the custom cookie.When the `HttpOnly` flag is included, the cookie is not accessible to scripts.                                                                                                                                                                                                                                                                                                                                                 |
| Custom Cookie SameSite attribute | Sets the `SameSite` attribute of the custom cookie.The default value is `LAX`, to align with most modern browsers.Learn more in [SameSite cookie rules](https://docs.pingidentity.com/pingam/7.3/security-guide/enable-samesite-cookies.html).                                                                                                                                                                                                                                             |

## Example

This example uses this node in a login flow. The custom cookie is set in the client browser after the user has successfully authenticated:

![The Set Custom Cookie node in context](_images/trees-node-set-custom-cookie.png)Figure 1. Access Management![The Set Custom Cookie node in context](_images/trees-node-set-custom-cookie-platform.png)Figure 2. Ping Identity Platform
