Page Contents
Home > @loopback/authentication > AuthenticationStrategy > authenticate
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:
authenticate(request: Request): Promise<UserProfile | RedirectRoute | undefined>;
Parameters
Parameter | Type | Description |
---|---|---|
request | Request | Express request object |
Returns:
Promise<UserProfile | RedirectRoute | undefined>