How to use the loopback4-authorization.AuthorizeErrorKeys.NotAllowedAccess function in loopback4-authorization

To help you get started, we’ve selected a few loopback4-authorization 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 sourcefuse / loopback4-starter / src / sequence.ts View on Github external
const {request, response} = context;

      const route = this.findRoute(request);
      const args = await this.parseParams(request, route);
      request.body = args[args.length - 1];
      await this.authenticateRequestClient(request);
      const authUser: AuthUser = await this.authenticateRequest(
      const isAccessAllowed: boolean = await this.checkAuthorisation(
        authUser && authUser.permissions,
      if (!isAccessAllowed) {
        throw new HttpErrors.Forbidden(AuthorizeErrorKeys.NotAllowedAccess);
      const result = await this.invoke(route, args);
      this.send(response, result);
    } catch (err) {
      this.reject(context, err);