next-auth-dynamodb
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -81,3 +81,3 @@ "use strict"; | ||
log("getUserByProviderAccountId", { providerId, providerAccountId }); | ||
const account = await AccountStore.getByHashAndRangeKey(providerId, providerAccountId); | ||
const account = await AccountStore.getByHashAndRangeKey(providerId, providerAccountId.toString()); | ||
log("getUserByProviderAccountId", { account }); | ||
@@ -109,3 +109,3 @@ if (!account) { | ||
providerId, | ||
providerAccountId, | ||
providerAccountId: providerAccountId.toString(), | ||
providerType, | ||
@@ -112,0 +112,0 @@ refreshToken, |
{ | ||
"name": "next-auth-dynamodb", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"contributors": [ | ||
@@ -5,0 +5,0 @@ "Tom Andrews <git@tomandrews.co.uk>" |
@@ -66,2 +66,32 @@ import Omanyd from "omanyd"; | ||
it("should not blow up if a provider uses numeric account ids", async () => { | ||
const adapter = await nextAuthDynamodb.getAdapter(opts); | ||
const savedUser = await adapter.createUser({ | ||
email: "foo@bar.com", | ||
emailVerified: false, | ||
name: "Foo Bar", | ||
image: "foo.png", | ||
}); | ||
const providerId = `providerId-${Date.now()}`; | ||
const providerAccountId = Date.now(); | ||
await adapter.linkAccount( | ||
savedUser.id, | ||
providerId, | ||
"providerType", | ||
providerAccountId as any, // Hack as the @types/next-auth is not correct | ||
"refreshToken", | ||
"accessToken", | ||
Date.now() | ||
); | ||
const readUser = await adapter.getUserByProviderAccountId( | ||
providerId, | ||
providerAccountId as any | ||
); | ||
expect(readUser).toStrictEqual(savedUser); | ||
}); | ||
it("should be able to update the user", async () => { | ||
@@ -68,0 +98,0 @@ const adapter = await nextAuthDynamodb.getAdapter(opts); |
@@ -121,3 +121,3 @@ import type { Adapter } from "next-auth/adapters"; | ||
providerId: string, | ||
providerAccountId: string | ||
providerAccountId: string | number | ||
) { | ||
@@ -127,3 +127,3 @@ log("getUserByProviderAccountId", { providerId, providerAccountId }); | ||
providerId, | ||
providerAccountId | ||
providerAccountId.toString() | ||
); | ||
@@ -148,3 +148,3 @@ log("getUserByProviderAccountId", { account }); | ||
providerType: string, | ||
providerAccountId: string, | ||
providerAccountId: string | number, | ||
refreshToken: string, | ||
@@ -166,3 +166,3 @@ accessToken: string, | ||
providerId, | ||
providerAccountId, | ||
providerAccountId: providerAccountId.toString(), | ||
providerType, | ||
@@ -169,0 +169,0 @@ refreshToken, |
25758
577