---
lang: en
title: 'API docs: authentication.tokenservice.generatetoken'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.authentication.tokenservice.generatetoken.html
---

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

[Home](./index.md) &gt; [@loopback/authentication](./authentication.md) &gt; [TokenService](./authentication.tokenservice.md) &gt; [generateToken](./authentication.tokenservice.generatetoken.md)

## TokenService.generateToken() method

Generates a token string based on a user profile

<b>Signature:</b>

```typescript
generateToken(userProfile: UserProfile): Promise<string>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  userProfile | <code>UserProfile</code> |  |

<b>Returns:</b>

`Promise<string>`


