Hey there, I'm looking to use Prisma with Amazon C...
# orm-help
a
Hey there, I'm looking to use Prisma with Amazon Cognito. Any idea on how to achieve this? Or any sample code ?
c
In what way are you looking to use them together? Using Cognito to control authn/authz with your graphQL API?
👍 1
s
I haven’t done this exact thing with cognito but have with auth0 and I’ve read some blog posts that describe it. The idea is that when you sign in with the react library on the frontend, you end up getting a jwt token which you can pass with every request to the backend server. The backend can verify and decode the token. The decoded token can have user information such as their ID, user type or whatever you want. Since you verify the token first, you can trust whatever you put in that token to do user lookups or whatever you need. So you end up doing that on every request the frontend makes to the backend.
a
great ! Thanks for the info @Stephen Jensen !
prisma cool 1
a
Here’s an outdated code base I put together that leverages cognito, lambda and prisma: https://github.com/servexyz/prisma-authorized-starter
“outdated” because it’s not using latest prisma version, but it should still be running/working properly
and if nothing else (ie. if it is broken now) should be a useful reference point
s
Ooh thanks alechp!
a
great resource, thanks a lot @alechp !
a
you’re both welcome