Custom data source (ex. allowing end user to add their own credentials)

Overall:

  • My use case here is maybe a bit different in that im trying to design some functionality with retool for an external customer, rather than an internal support tool.

Goal:

  • We're creating an admin dashboard (external facing) and my goal is to utilize some retool components within it (a great start for an MVP product). Right now, I have a table that displays data from either a dropdown, or a query box.

  • Right now the data source is set up to be the example db provided in postgres. But my goal is that a user that logs into the dashboard can be connected to their own postgres instance!

Possible Solutions:

  • User provides their credentials and presses connect. Then a connection string is created and a new data source is created for them.

  • Global admin panel injects connection string into state, and it is somehow passed into the retool application (not sure if retool state variables share a state with the application that imbeds them). Not ideal, as obviously I rather not store their password on our end when the database is originally created for them (and doesnt allow them to bring their own credentials to manage via the UI).

  • Create an authorized API that they can access with a bearer token passed in via the URL. Another solution that, like the above, is rather limited in nature and doesn't allow them to provide their own credentials.

I've seen this article here.

https://docs.retool.com/docs/secret-management-using-environment-variables

But this seems for more on-prem work. However, it does seem that you can configure a data source with some sort of variables within it... which is a step in the right direction.

Ah - I notice you guys have a flow for API Authentication - maybe databases are being added with a similar flow?

Hey there!

Unfortunately what you are trying to do is not possible completely inside of Retool currently. You could potentially set up an API to route queries to the proper Postgres DB based on the user who is authenticating with the API.

The user credentials could either be entered from the UI of the Retool application itself, or you could use a custom auth flow to associate credentials with individual Retool user accounts.

Hi @mark , I want to set password for some specific apps.
I didn't find any settings for that.
For instance, I shared my app link to someone and the other person can open with the password which is set by me for the app.

Hi @Vicky, we have some docs on user permissions you may be interested in. At this time, user-level permissions are only available on Business and Enterprise plans. All accounts on Free and Team plans have global Edit access by default and group attributes cannot be modified. Hope this helps! :slightly_smiling_face:

1 Like