Skip to main content

Class: Grants

Creates and checks grants.

Methods

create

create(sessionId, tokenOrTokens, customDuration?): Promise<void | void[]>

Creates a grant for a token or array of tokens

throws LunaSecError

Parameters

NameTypeDescription
sessionIdstringThe session ID of the user to create a grant for, should match whatever your sessionIdProvider in your LunaSec Config returns
tokenOrTokensstring | string[]The token to create a grant for, or an array of tokens
customDuration?stringThe time you would like the grant to last for as a string like "45s" or "1h10m30s", not to exceed the grant_maximum_time configured for the Tokenizer Backend. Omit to use the default configured time.

Returns

Promise<void | void[]>

Defined in

lunadefend/js/sdks/packages/node-sdk/src/grant-service/index.ts:80


verify

verify(sessionId, tokenOrTokens): Promise<void | void[]>

Verifies a token grant or array of token grants

throws LunaSecError

Parameters

NameType
sessionIdstring
tokenOrTokensstring | string[]

Returns

Promise<void | void[]>

Defined in

lunadefend/js/sdks/packages/node-sdk/src/grant-service/index.ts:139


createWithAutomaticSessionId

createWithAutomaticSessionId(req, token, customDuration?): Promise<void | void[]>

throws LunaSecError

Parameters

NameType
reqRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
tokenstring | string[]
customDuration?string

Returns

Promise<void | void[]>

Defined in

lunadefend/js/sdks/packages/node-sdk/src/grant-service/index.ts:182


verifyWithAutomaticSessionId

verifyWithAutomaticSessionId(req, token): Promise<void | void[]>

throws LunaSecError

Parameters

NameType
reqRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
tokenstring | string[]

Returns

Promise<void | void[]>

Defined in

lunadefend/js/sdks/packages/node-sdk/src/grant-service/index.ts:191