@loopback/docs
Version:
Documentation for LoopBack 4
55 lines (32 loc) • 2.04 kB
Markdown
lang: en
title: 'API docs: authentication.userservice'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.authentication.userservice.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/authentication](./authentication.md) > [UserService](./authentication.userservice.md)
## UserService interface
A service for performing the login action in an authentication strategy.
Usually a client user uses basic credentials to login, or is redirected to a third-party application that grants limited access.
Note: The creation of user is handled in the user controller by calling user repository APIs. For Basic auth, the user has to register first using some endpoint like `/register`<!-- -->. For 3rd-party auth, the user will be created if login is successful and the user doesn't exist in database yet.
Type `C` stands for the type of your credential object.
- For local strategy:
A typical credential would be: { username: username, password: password }
- For oauth strategy:
A typical credential would be: { clientId: string; clientSecret: string; callbackURL: string; }
It could be read from a local configuration file in the app
- For saml strategy:
A typical credential would be:
{ path: string; issuer: string; entryPoint: string; }
It could be read from a local configuration file in the app.
<b>Signature:</b>
```typescript
export interface UserService<U, C>
```
## Methods
| Method | Description |
| --- | --- |
| [convertToUserProfile(user)](./authentication.userservice.converttouserprofile.md) | Convert the user returned by <code>verifyCredentials()</code> to a common user profile that describes a user in your application |
| [verifyCredentials(credentials)](./authentication.userservice.verifycredentials.md) | Verify the identity of a user, construct a corresponding user profile using the user information and return the user profile. |