How to use the actionhero.api.params function in actionhero

To help you get started, we’ve selected a few actionhero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github actionhero / actionhero-angular-bootstrap-cors-csrf / initializers / session.js View on Github external
if (!sessionData) { throw new Error('Please log in to continue') }
            if (
              (data.action.indexOf('resque') < 0) &&
              (!data.params.csrfToken || data.params.csrfToken !== sessionData.csrfToken)
            ) { throw new Error('CSRF error') }

            data.session = sessionData
            const key = api.session.prefix + data.connection.fingerprint
            await redis.expire(key, api.session.ttl)
          }
        }
      }
    }

    api.actions.addMiddleware(api.session.middleware['logged-in-session'])
    api.params.globalSafeParams.push('csrfToken')
  }
}