# @newesissrl/payload-zitadel-plugin

> Extends `payloadcms` with [Zitadel](https://www.zitadel.com) integration

Latest version **1.0.3** (published 2025-10-20) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @newesissrl/payload-zitadel-plugin
pnpm add @newesissrl/payload-zitadel-plugin
yarn add @newesissrl/payload-zitadel-plugin
bun add @newesissrl/payload-zitadel-plugin
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2025-10-20 |
| First published | 2023-12-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 240.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Newesis Srl |
| Maintainers | amaghini, raunodepasquale |
| Keywords | mzinga, plugin, mzinga-plugin, zitadel |

## Links

- npm: https://www.npmjs.com/package/@newesissrl/payload-zitadel-plugin
- Repository: https://github.com/Newesissrl/payload-zitadel-plugin
- Homepage: https://github.com/Newesissrl/payload-zitadel-plugin#readme
- Issues: https://github.com/Newesissrl/payload-zitadel-plugin/issues
- npm.io page: https://npm.io/package/@newesissrl/payload-zitadel-plugin

## Dependencies (2)

- [dotenv](https://npm.io/package/dotenv.md) ^17.2.3
- [mzinga](https://npm.io/package/mzinga.md) 0.1.2

## Recent versions

- 1.0.3 (latest) — 2025-10-20
- 1.0.2 — 2025-09-27
- 1.0.1 — 2025-09-26
- 1.0.0 — 2025-09-15
- 0.0.38 — 2024-10-21
- 0.0.37 — 2024-09-02
- 0.0.36 — 2024-08-27
- 0.0.35 — 2024-08-01
- 0.0.34 — 2024-07-24
- 0.0.33 — 2024-05-21
- 0.0.32 — 2024-05-09
- 0.0.31 — 2024-05-09
- 0.0.30 — 2024-05-02
- 0.0.28 — 2024-03-12
- 0.0.26 — 2024-02-27
- … 19 more at https://npm.io/package/@newesissrl/payload-zitadel-plugin/versions

## README

# payload-zitadel-plugin

Extends `payloadcms` with [Zitadel](https://www.zitadel.com) integration

## Install

`yarn add @newesissrl/payload-zitadel-plugin`
`yarn add cookie-parser`

## Get Started



### server.ts
```js
const cookieParser = require("cookie-parser");
import { ZitadelRoutes } from "@newesissrl/payload-zitadel-plugin/dist/routes";
....
app.use(cookieParser());
....
await payload.init(....);
ZitadelRoutes(app);
....
```

### PAYLOAD_PUBLIC env variables

```sh
PAYLOAD_PUBLIC_ZITADEL_REDIRECT_URI=http://localhost:3030/zitadel/redirect
PAYLOAD_PUBLIC_ZITADEL_TOKEN_ENDPOINT=http://localhost:8080/oauth/v2/token
PAYLOAD_PUBLIC_ZITADEL_USER_INFO=http://localhost:8080/oidc/v1/userinfo
PAYLOAD_PUBLIC_ZITADEL_AUTHORIZE_ENDPOINT=http://localhost:8080/oauth/v2/authorize
PAYLOAD_PUBLIC_ZITADEL_CLIENT_ID= #the one you get from Zitadel app
PAYLOAD_PUBLIC_ZITADEL_COOKIE_NAME= #(optional) if you want to specify a different cookie name
PAYLOAD_PUBLIC_ZITADEL_COOKIE_SECURE= #(optional) if you want to specify a secure cookie (default = false)
PAYLOAD_PUBLIC_ZITADEL_COOKIE_SAMESITE= #(optional) if you want to specify a different sameSite option for cookie. default = "lax"
PAYLOAD_PUBLIC_COOKIE_DOMAIN= #(optional) if you want to specify a cookie domain
```

### payload.config.ts

```js
import { ZitadelStrategyPlugin } from "@newesissrl/payload-zitadel-plugin/dist/plugins";
import { LoginButton } from "@newesissrl/payload-zitadel-plugin/dist/components/LoginButton";

const buildConfigAsync = async () => {
    const zitadelPlugin = await ZitadelStrategyPlugin({
      ui: {
        beforeOrAfterLogin? // where to place the button (before|after, default = "after")
        loginButtonLabel? // the label to use for the login button (default = "login-with-zitadel")
        LoginButton: LoginButton // the component to use for the login button
      },
      auth: {
        authorizeEndpoint: process.env.PAYLOAD_PUBLIC_ZITADEL_AUTHORIZE_ENDPOINT,
        clientID: process.env.PAYLOAD_PUBLIC_ZITADEL_CLIENT_ID,
        redirectUri: process.env.PAYLOAD_PUBLIC_ZITADEL_REDIRECT_URI,
      },
      fieldsMappings: [], // useful to remap fields from idP to the desired `required` fields
      /*
      [{
        from: "name",
        to: "first_name"
      },
      ...]
      */
     loggerOptions? // optional logging options for `pino` library
    });
    return buildConfig({
      .....
      plugins: [...., zitadelPlugin],
    })
}
```

## Notes

If you want to override the `LoginButton` component, your React component must accept those properties:

```js
loginButtonLabel,
codeChallenge,
authorizeEndpoint,
redirectUri,
clientID,
scope,
codeChallengeMethod,
state
```

---
_Source: https://npm.io/package/@newesissrl/payload-zitadel-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
