Files
medusa-store/docs/content/references/js-client/classes/AuthResource.md
Shahed Nasser 3b28f46705 docs: added reference for JS Client (#1629)
* added reference for JS Client

* added reference for JS Client

* added reference for JS Client
2022-07-08 18:21:46 +03:00

77 lines
2.3 KiB
Markdown

# Class: AuthResource
## Hierarchy
- `default`
**`AuthResource`**
## Methods
### authenticate
**authenticate**(`payload`, `customHeaders?`): [`ResponsePromise`](../modules/internal.md#responsepromise)<[`StoreAuthRes`](../modules/internal.md#storeauthres)\>
**`description`** Authenticates a customer using email and password combination
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `payload` | [`StorePostAuthReq`](internal.StorePostAuthReq.md) | authentication payload |
| `customHeaders` | [`Record`](../modules/internal.md#record)<`string`, `any`\> | |
#### Returns
[`ResponsePromise`](../modules/internal.md#responsepromise)<[`StoreAuthRes`](../modules/internal.md#storeauthres)\>
#### Defined in
[packages/medusa-js/src/resources/auth.ts:16](https://github.com/medusajs/medusa/blob/2eb2126f/packages/medusa-js/src/resources/auth.ts#L16)
___
### exists
**exists**(`email`, `customHeaders?`): [`ResponsePromise`](../modules/internal.md#responsepromise)<[`StoreGetAuthEmailRes`](../modules/internal.md#storegetauthemailres)\>
**`description`** Check if email exists
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `email` | `string` | is required |
| `customHeaders` | [`Record`](../modules/internal.md#record)<`string`, `any`\> | |
#### Returns
[`ResponsePromise`](../modules/internal.md#responsepromise)<[`StoreGetAuthEmailRes`](../modules/internal.md#storegetauthemailres)\>
#### Defined in
[packages/medusa-js/src/resources/auth.ts:38](https://github.com/medusajs/medusa/blob/2eb2126f/packages/medusa-js/src/resources/auth.ts#L38)
___
### getSession
**getSession**(`customHeaders?`): [`ResponsePromise`](../modules/internal.md#responsepromise)<[`StoreAuthRes`](../modules/internal.md#storeauthres)\>
**`description`** Retrieves an authenticated session
Usually used to check if authenticated session is alive.
#### Parameters
| Name | Type |
| :------ | :------ |
| `customHeaders` | [`Record`](../modules/internal.md#record)<`string`, `any`\> |
#### Returns
[`ResponsePromise`](../modules/internal.md#responsepromise)<[`StoreAuthRes`](../modules/internal.md#storeauthres)\>
#### Defined in
[packages/medusa-js/src/resources/auth.ts:27](https://github.com/medusajs/medusa/blob/2eb2126f/packages/medusa-js/src/resources/auth.ts#L27)