Skip to content

Commit ef45c63

Browse files
committed
Add missing appId
1 parent d778249 commit ef45c63

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/app-store/_utils/oauth/updateTokenObject.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const updateTokenObjectInDb = async (
4141
authStrategy: "jwt";
4242
userId: number | null;
4343
credentialType: string;
44+
appId: string;
4445
delegatedToId: string | null;
4546
}
4647
| {
@@ -51,7 +52,7 @@ export const updateTokenObjectInDb = async (
5152
) => {
5253
const { tokenObject } = args;
5354
if (args.authStrategy === "jwt") {
54-
const { userId, delegatedToId, credentialType } = args;
55+
const { userId, delegatedToId, credentialType, appId } = args;
5556
if (!userId) {
5657
log.error("Cannot update token object in DB for Delegation as userId is not present");
5758
return;
@@ -77,6 +78,7 @@ export const updateTokenObjectInDb = async (
7778
delegationCredentialId: delegatedToId,
7879
type: credentialType,
7980
key: tokenObject as Prisma.InputJsonValue,
81+
appId,
8082
});
8183
}
8284
} else {

packages/app-store/googlecalendar/lib/CalendarAuth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ export class CalendarAuth {
219219
userId: this.credential.userId ?? null,
220220
delegatedToId: this.credential.delegatedToId ?? null,
221221
credentialType: this.credential.type,
222+
appId: metadata.slug,
222223
});
223224
if (this.oAuthClient) {
224225
this.oAuthClient.setCredentials(token);

packages/lib/server/repository/credential.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,15 @@ export class CredentialRepository {
214214
delegationCredentialId,
215215
type,
216216
key,
217+
appId,
217218
}: {
218219
userId: number;
219220
delegationCredentialId: string;
220221
type: string;
221222
key: Prisma.InputJsonValue;
223+
appId: string;
222224
}) {
223-
return prisma.credential.create({ data: { userId, delegationCredentialId, type, key } });
225+
return prisma.credential.create({ data: { userId, delegationCredentialId, type, key, appId } });
224226
}
225227

226228
static async updateWhereId({ id, data }: { id: number; data: { key: Prisma.InputJsonValue } }) {

0 commit comments

Comments
 (0)