---
lang: en
title: 'API docs: authentication.authenticationstrategy.authenticate'
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.authenticationstrategy.authenticate.html
---

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

[Home](./index.md) &gt; [@loopback/authentication](./authentication.md) &gt; [AuthenticationStrategy](./authentication.authenticationstrategy.md) &gt; [authenticate](./authentication.authenticationstrategy.authenticate.md)

## AuthenticationStrategy.authenticate() method

The 'authenticate' method takes in a given request and returns a user profile which is an instance of 'UserProfile'. (A user profile is a minimal subset of a user object) If the user credentials are valid, this method should return a 'UserProfile' instance. If the user credentials are invalid, this method should throw an error If the user credentials are missing, this method should throw an error, or return 'undefined' and let the authentication action deal with it.

**Signature:**

```typescript
authenticate(request: Request): Promise<UserProfile | RedirectRoute | undefined>;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

request


</td><td>

Request


</td><td>

Express request object


</td></tr>
</tbody></table>

**Returns:**

Promise&lt;[UserProfile](./security.userprofile.md) \| [RedirectRoute](./rest.redirectroute.md) \| undefined&gt;


