Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

feat(prisma): use new Adapter API #171

Merged
merged 33 commits into from
Aug 15, 2021
Merged

feat(prisma): use new Adapter API #171

merged 33 commits into from
Aug 15, 2021

Conversation

balazsorban44
Copy link
Member

@balazsorban44 balazsorban44 commented Jul 15, 2021

Based on nextauthjs/next-auth#2361

This PR also removes the prisma-legacy adapter entirely, so we can focus on a single one moving forward. Having two versions caused a fair amount of confusion anyway.

@github-actions github-actions bot added the prisma @next-auth/prisma-adapter related label Jul 15, 2021
@ndom91 ndom91 mentioned this pull request Jul 28, 2021
3 tasks
@@unique([providerId, providerAccountId])
type String
provider String
refresh_token String?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: is there a reason why some fields are in snake_case now? Prisma's docs use camelCase for their examples, and this seems to be true of most Prisma codebases I've seen.

Copy link
Member Author

@balazsorban44 balazsorban44 Aug 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly because the OAuth spec defines these as snake_case, and I thought it would make things easier if we just forward them "as-is". Using openid-client under the hood: https://www.npmjs.com/package/openid-client

@github-actions github-actions bot added the tests Changes to testing label Aug 8, 2021
@balazsorban44
Copy link
Member Author

TODO: Update test suite

@ndom91
Copy link
Member

ndom91 commented Aug 14, 2021

Hey I mentioned I was doing some work with prisma myself lately, right. Well I finally ran into the usecase of the @@unique([field1, field2]), like we have for the verification token.

I think that's only for defining fields to lookup by, that doesn't do anything in the actual db schema to make a union primary key or anything like that.

I think in prisma we might be good in terms of that security issue, as the table / model doesn't have any other keys to lookup by. So it has to be queried by this combination of fields.

But definitely something to keep in mind for other adapters, this will probably need an additional custom union primary key of the two fields and probably some logic in the adapter if I understood you and the security issue correctly

@balazsorban44 balazsorban44 marked this pull request as ready for review August 15, 2021 13:39
Copy link
Member

@ndom91 ndom91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
prisma @next-auth/prisma-adapter related tests Changes to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants