---
lang: en
title: 'API docs: authentication.authenticationbindings.auth_action'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/authentication
permalink: /doc/en/lb4/apidocs.authentication.authenticationbindings.auth_action.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/authentication](./authentication.md) &gt; [AuthenticationBindings](./authentication.authenticationbindings.md) &gt; [AUTH\_ACTION](./authentication.authenticationbindings.auth_action.md)

## AuthenticationBindings.AUTH\_ACTION variable

Key used to inject the authentication function into the sequence.

**Signature:**

```typescript
AUTH_ACTION: BindingKey<AuthenticateFn>
```

## Example


```ts
class MySequence implements SequenceHandler {
  constructor(
    @inject(AuthenticationBindings.AUTH_ACTION)
    protected authenticateRequest: AuthenticateFn,
    // ... other sequence action injections
  ) {}

  async handle(context: RequestContext) {
    try {
      const {request, response} = context;
      const route = this.findRoute(request);

     // Authenticate
      await this.authenticateRequest(request);

      // Authentication successful, proceed to invoke controller
      const args = await this.parseParams(request, route);
      const result = await this.invoke(route, args);
      this.send(response, result);
    } catch (err) {
      this.reject(context, err);
    }
  }
}
```


