Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions server/routes/readingHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,20 @@ async function getDatastoreClient() {
// because auth credentials may be passed in multiple ways, recycle pathway used by main auth logic
const {email, key} = await getAuth()

return new Datastore({
projectId,
credentials: {
// When using workload identity, email and key will be missing. Passing
// blank credentials will block authentication, so leave these out so we can
// default to using the workload identity.
let credentials = {}
if (email && key) {
credentials = {
client_email: email,
private_key: key
}
}

return new Datastore({
projectId,
...credentials
})
}

Expand Down