UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

67 lines (35 loc) 1.27 kB
--- lang: en title: 'API docs: authentication.tokenservice.generatetoken' 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.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 **Signature:** ```typescript generateToken(userProfile: UserProfile): Promise<string>; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> userProfile </td><td markdown="1"> [UserProfile](./security.userprofile.md) </td><td markdown="1"> A UserProfile for which a token should be generated. </td></tr> </tbody></table> **Returns:** Promise&lt;string&gt; a generated token/secret for a given UserProfile.