In the following code, is there a way to cast the clerk userId to an ObjectId? In this cased, clerkId is user_2eImnitE0bBq3mk06dsyh6u3sey and I need it to be something like 65d7b4e1b10459878c61cc6b.
This is because apparently sessionClaims in Clerk doesn't have userId on it, just user_sub, so this returns me null and I need to compare the Clerk userId on the database. Any help, please?
import EventForm from "@/components/shared/EventForm";
import { auth } from "@clerk/nextjs";
const CreateEvent = () => {
const { userId } = auth();
//original code
const { sessionClaims } = auth();
const userID = sessionClaims?.userId as string;
return (
<>
<section className="bg-primary-50 bg-dotted-pattern bg-cover bg-center py-5 md:py-10">
<h3 className="wrapper h3-bold text-center sm:text-left">
Create Event
</h3>
</section>
<div className="wrapper my-8">
{/* original code */}
<EventForm userId={userID} type="Create" />
<EventForm userId={userId as string} type="Create" />
</div>
</>
);
};
export default CreateEvent;