Hey there. 👋 I'm integrating Payload into a new React Typescript app that already uses clerk.js for auth.
I'd like to completely remove the Users collection and just use Clerk for my auth. It provides server-side functions for the currentUser and role and so on.
I can configure a new CollectionConfig with the right access permissions:
import type { Access, CollectionConfig } from "payload";
import { auth as fetchAuth } from "@clerk/nextjs/server";
export const isContentEditor: Access = async ({ req }) => {
// Check if the logged-in user has content editing permissions
const _auth = await fetchAuth();
return _auth.has({ permission: "org:content:edit" });
};
export const Courses: CollectionConfig = {
slug: "courses",
access: {
read: async ({ req }) => await isContentEditor({ req }),
create: async ({ req }) => await isContentEditor({ req }),
etc.
The problem is the admin dashboard - payload.config.ts still seems to require the slug for a users collection:
// payload.config.ts
export default buildConfig({
admin: {
user: Users.slug,
},
According to the docs, this is required.
Is there really no way to complete remove the Users collection and just use my own third party auth?