TokenProvider
Summary
Defines a TokenProvider to get and save Web Service tokens.
Constructor
TokenProvider
Syntax
TokenProvider
(
-
database
Summary
Parameters:
-
database
DatabaseThe database to interact with
Item Index
Methods
Methods
add
Syntax
add
(
async
-
tokens
-
[callback]
Summary
Adds tokens.
Parameters:
-
tokens
ArrayThe list of tokens to store with for each token:
- String clientId The client id the token belongs to
- Number ttl The time to live in milliseconds of the token
- Array [scopes] A list of scopes with granted access for this token
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number The total amount of tokens inserted
- Array The list of added tokens
createIndexes
Syntax
createIndexes
(
async
-
callback
Summary
Creates tokens indexes.
Parameters:
-
callback
FunctionFunction to call when it's done with :
- Error An error if something went wrong, null otherwise
updateOne
Syntax
updateOne
(
async
-
[filter]
-
data
-
[callback]
Summary
Updates a token.
Parameters:
-
[filter]
ResourceFilter optionalRules to filter the token to update
-
data
ObjectThe modifications to perform
-
[ttl]
Number optionalThe time to live in milliseconds of the token
-
-
[callback]
Function optionalThe function to call when it's done
- Error The error if an error occurred, null otherwise
- Number 1 if everything went fine