# give/4.18.0/src/DonationForms/resources/app/utilities/authToken.ts

GiveWP – Donation Plugin and Fundraising Platform, version 4.18.0. 25 lines.

- Page: https://pluginprobe.com/plugins/give/4.18.0/code/src/DonationForms/resources/app/utilities/authToken.ts
- Raw: https://pluginprobe.com/plugins/give/4.18.0/raw/src/DonationForms/resources/app/utilities/authToken.ts
- Modified: 2026-09-23T17:56:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.18.0/code/src/DonationForms/resources/app/utilities/authToken.ts#L10-L20`.

```typescript
/**
 * The auth token the authentication route returns after a successful login.
 *
 * Inside a cross-site iframe the browser drops the WordPress login cookie, so
 * this token is what keeps the donor signed in for the validate and donate
 * requests. It is request transport, not form data: keeping it out of the form
 * values keeps it out of the client-side validation schema, which rejects keys
 * it does not know.
 *
 * It lives on window.givewp.form because the login template and the form app
 * ship in separate bundles, so module state would not be shared between them.
 *
 * @since 4.17.0
 */
export function setAuthToken(token: string): void {
    window.givewp.form.authToken = token ?? '';
}

/**
 * @since 4.17.0
 */
export function getAuthToken(): string {
    return window.givewp?.form?.authToken ?? '';
}

```
