MCPcopy
hub / github.com/nextauthjs/next-auth / getUserByAccount

Function getUserByAccount

packages/adapter-firebase/src/index.ts:97–117  ·  view source on GitHub ↗
({ provider, providerAccountId })

Source from the content-addressed store, hash-verified

95 return null
96 },
97 async getUserByAccount({ provider, providerAccountId }) {
98 const accountQuery = query(
99 Accounts,
100 where("provider", "==", provider),
101 where("providerAccountId", "==", providerAccountId),
102 limit(1)
103 )
104 const accountSnapshots = await getDocs(accountQuery)
105 const accountSnapshot = accountSnapshots.docs[0]
106
107 if (accountSnapshot?.exists()) {
108 const { userId } = accountSnapshot.data()
109 const userDoc = await getDoc(doc(Users, userId))
110
111 if (userDoc.exists() && Users.converter) {
112 return Users.converter.fromFirestore(userDoc)
113 }
114 }
115
116 return null
117 },
118
119 async updateUser(partialUser) {
120 const userRef = doc(Users, partialUser.id)

Callers

nothing calls this directly

Calls 1

queryFunction · 0.85

Tested by

no test coverage detected