Generate experiences with Puck AI
Read docs
CloudAPI referenceplugin-authcreateAuthPlugin

createAuthPlugin

Puck Auth is experimental and may change in a future release.

Create a plugin that shows who signed in with Puck Auth, and a menu to sign out.

npm i @puckeditor/plugin-auth --save
import { createAuthPlugin } from "@puckeditor/plugin-auth";
 
const authPlugin = createAuthPlugin();
 
export function Editor() {
  return (
    <Puck
      plugins={[authPlugin]}
      // ...
    />
  );
}

The plugin needs puckHandler() with auth.provider set to "puck". It shows nothing until someone signs in.

See Set up Puck Auth for a full setup.

Params

ParamExampleTypeStatus
hosthost: "https://www.example.com/api/puck/auth"String-

Optional params

host

Set where puckHandler serves the sign-in routes. Defaults to /api/puck/auth.

const authPlugin = createAuthPlugin({
  host: "https://www.example.com/api/puck/auth",
});