Files
medusa-store/www/apps/docs/content/references/services/classes/TokenService.mdx
2023-11-29 11:58:08 +00:00

143 lines
2.4 KiB
Plaintext

---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# TokenService
## constructor
`**new TokenService**(«destructured»)`
### Parameters
<ParameterTypes parameters={[
{
"name": "__namedParameters",
"type": "[InjectedDependencies](../types/InjectedDependencies-41.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
___
## Properties
<ParameterTypes parameters={[
{
"name": "configModule_",
"type": "[ConfigModule](../types/ConfigModule.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "RESOLUTION_KEY",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
___
## Methods
### signToken
`**signToken**(data, options?): string`
#### Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "`string` \\| `object` \\| [Buffer](../index.md#buffer)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`SignOptions`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`string`
<ParameterTypes parameters={[
{
"name": "string",
"type": "`string`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### verifyToken
`**verifyToken**(token, options?): string \| Jwt \| JwtPayload`
#### Parameters
<ParameterTypes parameters={[
{
"name": "token",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "`VerifyOptions`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`string` \| `Jwt` \| `JwtPayload`
<ParameterTypes parameters={[
{
"name": "string \\| Jwt \\| JwtPayload",
"type": "`string` \\| `Jwt` \\| `JwtPayload`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />