> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-actions-transaction-metadata.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Share Values from Custom Token Exchange to Post-Login

> Set a key/value pair from a Custom Token Exchange Action and read it from a Post-Login Action in the same transaction.

Set a key/value pair from a [Custom Token Exchange](/docs/customize/actions/explore-triggers/custom-token-exchange) Action and read it from a Post-Login Action in the same transaction. This is useful, for example, to set a custom claim in Post-Login based on information your Custom Token Exchange Action already obtained or processed from the `subject_token` or `actor_token`.

**Custom Token Exchange Action**

Decode a claim from the `subject_token` and set it as transaction metadata with the `api` object's `setMetadata` method.

```javascript lines theme={null}
exports.onExecuteCustomTokenExchange = async (event, api) => {
  // subject_token has already been decoded and validated earlier in the Action
  api.transaction.setMetadata('subject_locale', subjectTokenPayload.locale);
};
```

**Post-Login Action**

Read the `subject_locale` value set by the Custom Token Exchange Action with the `event` object's `transaction.metadata` property, and use it to set a custom claim. The claim can be added to the access token, the ID token, or both.

```javascript lines theme={null}
exports.onExecutePostLogin = async (event, api) => {
  const locale = event.transaction?.metadata?.subject_locale;
  if (locale) {
    api.idToken.setCustomClaim('https://example.com/locale', locale);
    api.accessToken.setCustomClaim('https://example.com/locale', locale);
  }
};
```
