Releases: CrawlerCode/payload-authjs
Releases · CrawlerCode/payload-authjs
v0.9.1
v0.9.0
0.9.0 (2025-10-06)
🚀 Features
- Add support for Auth.js passkey provider (#45)
- Receive the auth.js instance from the payload using getAuthjsInstance (8230215)
🩹 Fixes
🏡 Chore
- Add bundle size badge to README (c8bdcd1)
- deps: Update npm dependencies (dbd0141)
- nx: Use payload-authjs as workspace package for dev project (22021c4)
MIGRATION GUIDE
This version introduces a new setup method for the Auth.js instance.
Creating the Auth.js instance
Now you can obtain the Auth.js instance directly from the payload instance by using the getAuthjsInstance function. You no longer need to use the withPayload function and create the NextAuth instance.
Before:
// auth.ts
export const { handlers, signIn, signOut, auth } = NextAuth(
withPayload(authConfig, {
payloadConfig,
}),
);After:
// auth.ts
const payload = await getPayload({ config: payloadConfig });
export const { handlers, signIn, signOut, auth } = getAuthjsInstance(payload);Lazy initialization of the Auth.js instance
If your are using lazy initialization of the Auth.js instance, you must use withPayloadAuthjs to set up the instance manually:
// auth.ts
export const { handlers, signIn, signOut, auth } = NextAuth(async () =>
withPayloadAuthjs({
payload: await getPayload({ config: payloadConfig }),
config: authConfig,
collectionSlug: "users",
}),
);See #35 for more details.
Custom events
If you define custom events within withPayload, you must move them directly into the auth.js configuration (auth.config.ts):
// auth.ts
export const { handlers, signIn, signOut, auth } = NextAuth(
withPayload(authConfig, {
payloadConfig,
events: {
signIn: async ({ adapter, payload, user }) => {
// ...
},
},
}),
);// auth.config.ts
import { EnrichedAuthConfig } from "payload-authjs";
export const authConfig: EnrichedAuthConfig = {
// ...
events: {
signIn: async ({ adapter, payload, user }) => {
// ...
},
},
};Further details can be found in the events section.
v0.8.4
0.8.4 (2025-09-02)
🩹 Fixes
- Destroy authjs session using payload logout hook instead of overriding logout endpoints (912da9a)
- Remove custom array id field for verificationTokens (#41)
- PayloadSessionProvider: Unset the local session then request failed (ada1fdf)
- SignInButton: Mount authjs SessionProvider to the admin panel to provide custom base path (#44)
🏡 Chore
- deps: Update npm dependencies (3885fc4)
- dev: Improve session overview and sign in/out buttons (c2d6698)
📓 Examples
- Use authjs signOut server action (#43)
v0.8.3
v0.8.2
v0.8.1
v0.8.0
0.8.0 (2025-04-06)
🚀 Features
- Add custom account row label component (89ce1a7)
- Add support for other auth strategies (2c94c40)
- getPayloadSession: Cache getPayloadSession function (ff3b25b)
🩹 Fixes
- Merge remaining properties for fields with subfield (cfa143d)
- Execute afterLogout hooks at logout endpoint (#16)
- Extend PayloadSession with collection and strategy (4ca2cdf)
- Fix mergeFields function for tabs fields (bdb393c)
- Refresh authjs session cookie at payload "refresh-token" endpoint (66e50fc)
- Revalidate payload-session tag on logout and refresh (25d4b8d)
- Move from tsc to swc to be compatible with turbopack (#18)
- AuthjsAuthStrategy: Respect auth.depth option of users collection (c06262b)
- PayloadSessionProvider: Abort fetch session on unmount (0a5e859)
- getPayloadSession: Preferably extract strategy from user._strategy & improved types (4b66142)
🔥 Performance
- PayloadAdapter: Only retrieve necessary fields (6beebd2)
📖 Documentation
🏡 Chore
- deps: Update npm dependencies (d269d92)
- deps: Update npm dependencies (d98f3aa)
- deps: Update npm dependencies (7e6a164)
- deps: Set minimal required payload version to 3.16.0 (because export of headersWithCors) (b76df1a)
- dev: Improve edge compatibility and some other small changes (d5e5d9e)
- dev: Add token rotation for keycloak provider & sync account expires date with session expires (27ee17b)
- dev: Add mongoose adapter (b6c4e23)
- nx: Add examples type to changelog (5e9b181)
📓 Examples
v0.7.1
v0.7.0
0.7.0 (2025-02-09)
🚀 Features
- Allow custom tabs field in users collection (#14)
- Add getPayloadSession & usePayloadSession (146eebe)
- AuthjsAuthStrategy: Log a warning if user not found in the database but has an valid authjs session (1999a20)
- PayloadAdapter: Added payload logger and log debug messages (957f589)
🩹 Fixes
- Override payload refresh operation & fix session expiration (#12)
📖 Documentation
- Add "Getting the payload session" section & improved some other wordings (f911249)
🏡 Chore
- Fix eslint & typescript errors (d9c5895)
- dev: Change nextjs port to 5000 (0115f0e)
- dev: Allow js files (for import map) (3b4b16b)
- dev: Add greeting component to admin dashboard (becc12a)
- dev: Added all different options to get the session & add tailwind (57637ab)
- dev: Add currentAccount field (3f1711d)
DEPRECATION
getPayloadUser is now deprecated. You should use getPayloadSession instead:
- import { getPayloadUser } from "payload-authjs";
+ import { getPayloadSession } from "payload-authjs";
const ServerComponentExample = async () => {
- const payloadUser = await getPayloadUser();
+ const session = await getPayloadSession();
return (
<>
<h3>Payload CMS User:</h3>
- <pre>{JSON.stringify(payloadUser)}</pre>
+ <pre>{JSON.stringify(session?.user)}</pre>
</>
);
};