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!