Using custom auth with Plasmic and Next-Auth.

Hello everyone! I’m starting to look at the Plasmic platform which I think is great! But before getting deeper into it, I want to check whether it’s possible to use custom auth with, let’s say Next-Auth library on NextJS. The application I’m working on uses Keycloak for auth, which is integrated to NextJS by using the Next-Auth library. Any insights regarding this combination is welcome!

Hi Franco, it’s possible to use it as custom auth, we don’t have an existing example with it, but you can integrate it by using the session callback https://next-auth.js.org/configuration/callbacks#session-callback and properly running ensurePlasmicAppUser https://docs.plasmic.app/learn/auth-integration/#ensureplasmicappuser

great insight Felipe, thanks a lot!

do you think it’s going to be possible to later use one user (with roles from Keycloak) within the designer?

user retrieved from Keycloak, and session managed by Next-Auth

I believe keycloak can express more distinct hierarchies than the way it’s expressed in plasmic https://docs.plasmic.app/learn/auth/#roles-and-ordering , but you should still be able to replicate your existing roles in keycloack back into plasmic studio and properly bind content to a specific role.

thanks a lot!

Hi guys,

I am trying to connect our Keycloak Authentication with the into the custom plasmic auth and stubbled upon this thread.

I got NextAuth and Keycloak running in a demo Next.js project and would like to integrate this into the codebase I have hooked up with Plasmic.

First of all, thanks for the links.

Has there been an example implementation set up in the meantime?

Or is there maybe an integration with a similar provider to Keycloak which I can consult for reference?

Thanks in advance,
Best,
Jan