OpenVeo Core server

API Docs for: 7.0.0
Show:

TokenProvider

Summary

Defines a TokenProvider to get and save Web Service tokens.

Constructor

TokenProvider

Syntax

TokenProvider

(
  • database
)

Summary

Parameters:

  • database Database

    The database to interact with

Item Index

Methods

add

Syntax

add

(
  • tokens
  • [callback]
)
async

Summary

Adds tokens.

Parameters:

  • tokens Array

    The 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 optional

    The 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

(
  • callback
)
async

Summary

Creates tokens indexes.

Parameters:

  • callback Function

    Function to call when it's done with :

    • Error An error if something went wrong, null otherwise

updateOne

Syntax

updateOne

(
  • [filter]
  • data
  • [callback]
)
async

Summary

Updates a token.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter the token to update

  • data Object

    The modifications to perform

    • [ttl] Number optional

      The time to live in milliseconds of the token

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine