WiP updates

This commit is contained in:
Tomas Bures 2018-04-22 09:00:04 +02:00
parent 6706d93bc1
commit 4fce4b6f81
27 changed files with 763 additions and 85 deletions

View file

@ -371,12 +371,12 @@ function registerRestrictedAccessTokenMethod(method, getHandlerFromParams) {
restrictedAccessTokenMethods[method] = getHandlerFromParams;
}
function getRestrictedAccessToken(context, method, params) {
async function getRestrictedAccessToken(context, method, params) {
const token = crypto.randomBytes(24).toString('hex').toLowerCase();
const tokenEntry = {
token,
userId: context.user.id,
handler: restrictedAccessTokenMethods[method](params),
handler: await restrictedAccessTokenMethods[method](params),
expires: Date.now() + 120 * 1000
};