(account: AdapterAccount)
| 28 | return { |
| 29 | ...baseAdapter, |
| 30 | async linkAccount(account: AdapterAccount) { |
| 31 | const idpConfig = await getIdentityProviderConfig(account.provider); |
| 32 | if (!idpConfig) { |
| 33 | throw new Error(`Failed to link account for user id ${account.userId}. No provider config found for account with type ${account.provider}`); |
| 34 | } |
| 35 | |
| 36 | const { provider, ...rest } = encryptAccountTokens(account); |
| 37 | await prisma.account.create({ |
| 38 | data: { |
| 39 | ...rest, |
| 40 | providerId: provider, |
| 41 | providerType: idpConfig.provider, |
| 42 | }, |
| 43 | }); |
| 44 | return account; |
| 45 | }, |
| 46 | async getUserByAccount({ provider, providerAccountId }) { |
| 47 | const account = await prisma.account.findUnique({ |
| 48 | where: { |
nothing calls this directly
no test coverage detected