Dynamic Values & JWT Authentication with NextAuth.js

Hello,

I am implementing a custom authentication system using NextAuth.js because the built-in Plasmic Custom Auth module was too restrictive for my needs. I am authenticating users with Google Auth, and after a successful login, I generate and store a JWT token that should be used for future authentication.

The Issue I’m Facing

Now, I am running into a problem where I cannot access the currently authenticated user inside Plasmic Studio, which prevents me from effectively using dynamic values and building authenticated components.

In more detail:

  1. No way to access the current user in Plasmic Studio
  • I want to define a dynamic value (e.g., showing the balance of the logged-in user) in the Plasmic Data Query Builder.
  • However, there is no clear way to reference the currently authenticated user in queries.
  • Normally, I’d expect to have access to something like currentUser.email or auth.userId, but that does not seem to be possible.
  1. JWT Authentication inside Plasmic Studio
  • Since I am handling authentication through JWTs, I need Plasmic to send the JWT as part of the request when querying the database.
  • However, Plasmic’s query builder does not seem to support JWT-based authentication, meaning I cannot securely fetch user-specific data.
  1. Looping through authenticated data in repeatable elements
  • Even if I manually enter an email for testing, I also want to create repeating elements, like a transaction list that loops through a user’s balance history.
  • However, since there is no way to authenticate using a JWT within Plasmic, I cannot retrieve user-specific records dynamically.

What I Need to Solve

  • How can I pass the currently logged-in user’s email (or some kind of identifier) into Plasmic’s dynamic value queries?
  • Is there a way to make Plasmic send the JWT when making API requests, so that authentication works properly?
  • What is the recommended way to create repeatable elements that only show authenticated user-specific data when using a custom NextAuth.js implementation?

Would love to hear the best approach for integrating custom auth with dynamic values and JWT authentication inside Plasmic Studio.

Thanks!
Clemens