Connect with postgress username password supplied at run time by user, not in the connection resource

Hi Again,

I want the users of my retool app to connect to postgres using credentials (username/password) that the user supplies. That means that I do NOT want to the username and password in the resource connection string, but I do want to use the host, port and database name (though I can give up on those, too).

How do I create a login screen that will override the username and password in the postgresql database connection resource?

Thank You,

Chris

Hey @chrismaden!

It's possible to reference values from {{ current_user }} in your resource settings:

To pair with that, there should be an option in the "Beta" tab of your settings that prevents spoofing of the current_user variable:

This way you can create separate database users and protect them behind Retool's user authentication.

Could this work for your use case?

Hey, does this still work? Or does accessing {{ current_user }} only work in an rest API resource? Thanks in advance!

Looking to use it in a Postgres resource to access our database as different users.