Skip to content
Closed
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
10 changes: 7 additions & 3 deletions packages/backend/src/api/endpoints/M2MTokenApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ type CreateM2MTokenParams = {
*/
machineSecretKey?: string;
/**
* Number of seconds until the token expires.
* Number of milliseconds until the token expires.
*
* @default null - Token does not expire
*/
millisecondsUntilExpiration?: number | null;
/**
* @deprecated Use `millisecondsUntilExpiration` instead. This property will be removed in the next major release.
*/
secondsUntilExpiration?: number | null;
claims?: Record<string, unknown> | null;
};
Expand Down Expand Up @@ -59,14 +63,14 @@ export class M2MTokenApi extends AbstractAPI {
}

async createToken(params?: CreateM2MTokenParams) {
const { claims = null, machineSecretKey, secondsUntilExpiration = null } = params || {};
const { claims = null, machineSecretKey, millisecondsUntilExpiration = null } = params || {};

const requestOptions = this.#createRequestOptions(
{
method: 'POST',
path: basePath,
bodyParams: {
secondsUntilExpiration,
millisecondsUntilExpiration,
claims,
},
},
Expand Down