@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
81 lines (41 loc) • 1.67 kB
Markdown
---
lang: en
title: 'API docs: authentication-passport.strategyadapter.authenticate'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/extensions/authentication-passport
permalink: /doc/en/lb4/apidocs.authentication-passport.strategyadapter.authenticate.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/authentication-passport](./authentication-passport.md) > [StrategyAdapter](./authentication-passport.strategyadapter.md) > [authenticate](./authentication-passport.strategyadapter.authenticate.md)
## StrategyAdapter.authenticate() method
The function to invoke the contained passport strategy. 1. Create an instance of the strategy 2. add success and failure state handlers 3. authenticate using the strategy
**Signature:**
```typescript
authenticate(request: Request, options?: AuthenticateOptions): Promise<UserProfile | RedirectRoute>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
request
</td><td markdown="1">
Request
</td><td markdown="1">
The incoming request.
</td></tr>
<tr><td markdown="1">
options
</td><td markdown="1">
AuthenticateOptions
</td><td markdown="1">
_(Optional)_ Options passed through to strategy.authenticate.
</td></tr>
</tbody></table>
**Returns:**
Promise<[UserProfile](./security.userprofile.md) \| [RedirectRoute](./rest.redirectroute.md)<!-- -->>