Using AWS IAM for authentication #4147
-
|
I have been using Prisma on a prototype for a project and while I absolutely love it, I have come across a snag. My organization uses IAM for authentication on Amazon RDS and it appears Prisma will not work well with this method. I could of course generate a password token for RDS prior to starting my app, but the tokens expire every 15 minutes and I can't think of a good away of handling the reconnect. Do you have plans to support IAM or other arbitrary async authentication mechanisms? Is there a way to achieve this now and I just haven't found it yet? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
|
Hey @jonapgartwohat 👋 You could add your DB URL in this manner as described here import { PrismaClient } from '@prisma/client'
const client = new PrismaClient({ datasources: { mydb: { url: 'postgres://localhost/db1' }} })This will override the URL and you would be able to pass the token as the password. In this case, you would need a mechanism to reconnect if the token has expired which you would need to manage yourself. Also IAM DB Auth requires SSL so you would need to connect Prisma to your DB with SSL first. Let me know if this helps :) |
Beta Was this translation helpful? Give feedback.
-
|
We decided to use Prisma with IAM by creating a new Prisma client for every HTTP request that comes through the server. This is a huge waste, and is only possible because we have so few active users. It's a shame that this can't be accomplished with Prisma, when something like Knex makes it so easy. Wish Knex, you can set an |
Beta Was this translation helpful? Give feedback.
-
|
Added issue #7869 with a proposed solution. |
Beta Was this translation helpful? Give feedback.
-
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that have already been marked as answered but remain open. If this discussion still requires further input or clarification, feel free to reopen it or start a new one with updated details. Your contributions are invaluable to the community, and we’re here to help! For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and ongoing support of the Prisma community! |
Beta Was this translation helpful? Give feedback.
Added issue #7869 with a proposed solution.