Skip to content

Commit d79539f

Browse files
authored
Provide expiration time for token generation (#1712)
Part of OPS-3112.
1 parent b12093e commit d79539f

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

packages/server/api/src/app/authentication/context/create-project-auth-context.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { accessTokenManager } from './access-token-manager';
1515
export async function getProjectAndToken(
1616
user: User,
1717
tablesRefreshToken: string,
18+
expiresInSeconds?: number,
1819
): Promise<{
1920
user: User;
2021
project: Project;
@@ -38,15 +39,18 @@ export async function getProjectAndToken(
3839
project.organizationId,
3940
);
4041

41-
const token = await accessTokenManager.generateToken({
42-
id: user.id,
43-
externalId: user.externalId,
44-
type: PrincipalType.USER,
45-
projectId: project.id,
46-
organization: {
47-
id: organization.id,
42+
const token = await accessTokenManager.generateToken(
43+
{
44+
id: user.id,
45+
externalId: user.externalId,
46+
type: PrincipalType.USER,
47+
projectId: project.id,
48+
organization: {
49+
id: organization.id,
50+
},
4851
},
49-
});
52+
expiresInSeconds,
53+
);
5054

5155
return {
5256
user: updatedUser,

0 commit comments

Comments
 (0)