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
3 changes: 2 additions & 1 deletion src/service-account/util/Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type ResponseSignedDataTokens = { token: string, signedToken: string }
export type BearerTokenOptions = {
ctx?: string,
roleIDs?: string[],
exp?: number,
}

export type SignedDataTokensOptions = {
Expand Down Expand Up @@ -84,7 +85,7 @@ function getToken(credentials, options?: BearerTokenOptions): Promise<ResponseTo
printLog(errorMessages.NotAValidJSON, MessageType.ERROR);
throw new SkyflowError({ code: 400, description: errorMessages.NotAValidJSON });
}
const expiryTime = Math.floor(Date.now() / 1000) + 3600;
const expiryTime = Math.floor(Date.now() / 1000) + (options?.exp !== undefined ? Math.min(Math.max(options.exp), 1) : 3600);

const claims = {
iss: credentialsObj.clientID,
Expand Down