[reactive-feathers-state](../README.md) / [authStore](../modules/authstore.md) / AuthStore

# Class: AuthStore<UserModel\>

[authStore](../modules/authstore.md).AuthStore

## Type parameters

Name |
------ |
`UserModel` |

## Hierarchy

* **AuthStore**

## Table of contents

### Constructors

- [constructor](authstore.authstore-1.md#constructor)

### Properties

- [authError](authstore.authstore-1.md#autherror)
- [client](authstore.authstore-1.md#client)
- [console](authstore.authstore-1.md#console)
- [debug](authstore.authstore-1.md#debug)
- [expireFormat](authstore.authstore-1.md#expireformat)
- [isAuthPending](authstore.authstore-1.md#isauthpending)
- [onAuthentication](authstore.authstore-1.md#onauthentication)
- [rootStore](authstore.authstore-1.md#rootstore)
- [state](authstore.authstore-1.md#state)
- [storage](authstore.authstore-1.md#storage)
- [storageKey](authstore.authstore-1.md#storagekey)
- [userService](authstore.authstore-1.md#userservice)

### Methods

- [afterAuthenticate](authstore.authstore-1.md#afterauthenticate)
- [afterLogout](authstore.authstore-1.md#afterlogout)
- [authenticate](authstore.authstore-1.md#authenticate)
- [beforeLogout](authstore.authstore-1.md#beforelogout)
- [getNow](authstore.authstore-1.md#getnow)
- [handleEvents](authstore.authstore-1.md#handleevents)
- [initialize](authstore.authstore-1.md#initialize)
- [logout](authstore.authstore-1.md#logout)
- [onAuthenticationChange](authstore.authstore-1.md#onauthenticationchange)
- [reAuthenticate](authstore.authstore-1.md#reauthenticate)
- [save](authstore.authstore-1.md#save)

## Constructors

### constructor

\+ **new AuthStore**<UserModel\>(`rootStore`: [*RootStore*](rootstore.rootstore-1.md), `options`: [*IAuthStoreOptions*](../interfaces/authstore.iauthstoreoptions.md)): [*AuthStore*](authstore.authstore-1.md)<UserModel\>

#### Type parameters:

Name |
------ |
`UserModel` |

#### Parameters:

Name | Type |
------ | ------ |
`rootStore` | [*RootStore*](rootstore.rootstore-1.md) |
`options` | [*IAuthStoreOptions*](../interfaces/authstore.iauthstoreoptions.md) |

**Returns:** [*AuthStore*](authstore.authstore-1.md)<UserModel\>

Defined in: [src/authStore.ts:54](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L54)

## Properties

### authError

• **authError**: *Ref*<*undefined* \| *null* \| { `message`: *string* ; `name`: *string* ; `stack?`: *undefined* \| *string*  }\>

Defined in: [src/authStore.ts:42](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L42)

___

### client

• **client**: *Application*<*any*\>

Defined in: [src/authStore.ts:35](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L35)

___

### console

• **console**: { `error`: (...`args`: *any*[]) => *false* \| *void* ; `groupCollapsed`: (`label`: *string*) => *false* \| *void* ; `groupEnd`: () => *false* \| *void* ; `log`: (...`args`: *any*[]) => *false* \| *void* ; `time`: (`name`: *string*) => *false* \| *void* ; `timeEnd`: (`name`: *string*) => *false* \| *void*  }

#### Type declaration:

Name | Type |
------ | ------ |
`error` | (...`args`: *any*[]) => *false* \| *void* |
`groupCollapsed` | (`label`: *string*) => *false* \| *void* |
`groupEnd` | () => *false* \| *void* |
`log` | (...`args`: *any*[]) => *false* \| *void* |
`time` | (`name`: *string*) => *false* \| *void* |
`timeEnd` | (`name`: *string*) => *false* \| *void* |

Defined in: [src/authStore.ts:44](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L44)

___

### debug

• **debug**: *boolean*= false

Defined in: [src/authStore.ts:43](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L43)

___

### expireFormat

• **expireFormat**: *seconds* \| *miliseconds*= 'seconds'

Defined in: [src/authStore.ts:39](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L39)

___

### isAuthPending

• **isAuthPending**: *Ref*<*boolean*\>

Defined in: [src/authStore.ts:41](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L41)

___

### onAuthentication

• `Optional` **onAuthentication**: *undefined* \| (`token?`: *null* \| *string*) => *void*

Defined in: [src/authStore.ts:34](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L34)

___

### rootStore

• **rootStore**: [*RootStore*](rootstore.rootstore-1.md)

Defined in: [src/authStore.ts:40](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L40)

___

### state

• **state**: IAuthStoreState

Defined in: [src/authStore.ts:29](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L29)

___

### storage

• **storage**: [*IKeyValueStore*](../modules/types.md#ikeyvaluestore)

Defined in: [src/authStore.ts:36](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L36)

___

### storageKey

• **storageKey**: *string*

Defined in: [src/authStore.ts:33](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L33)

___

### userService

• `Optional` **userService**: *undefined* \| [*ServiceStore*](servicestore.servicestore-1.md)<UserModel, *any*\>

Defined in: [src/authStore.ts:38](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L38)

## Methods

### afterAuthenticate

▸ **afterAuthenticate**(`token?`: *string*): *void*

#### Parameters:

Name | Type |
------ | ------ |
`token?` | *string* |

**Returns:** *void*

Defined in: [src/authStore.ts:46](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L46)

___

### afterLogout

▸ **afterLogout**(): *void*

**Returns:** *void*

Defined in: [src/authStore.ts:52](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L52)

___

### authenticate

▸ **authenticate**(`email`: *string*, `password`: *string*): *Promise*<*any*\>

#### Parameters:

Name | Type |
------ | ------ |
`email` | *string* |
`password` | *string* |

**Returns:** *Promise*<*any*\>

Defined in: [src/authStore.ts:158](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L158)

___

### beforeLogout

▸ **beforeLogout**(): *void*

**Returns:** *void*

Defined in: [src/authStore.ts:49](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L49)

___

### getNow

▸ **getNow**(): *number*

**Returns:** *number*

Defined in: [src/authStore.ts:98](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L98)

___

### handleEvents

▸ **handleEvents**(): *void*

**Returns:** *void*

Defined in: [src/authStore.ts:83](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L83)

___

### initialize

▸ **initialize**(): *Promise*<*void*\>

**Returns:** *Promise*<*void*\>

Defined in: [src/authStore.ts:107](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L107)

___

### logout

▸ **logout**(): *Promise*<*void*\>

**Returns:** *Promise*<*void*\>

Defined in: [src/authStore.ts:215](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L215)

___

### onAuthenticationChange

▸ **onAuthenticationChange**(`token`: *null* \| *string*): *void*

#### Parameters:

Name | Type |
------ | ------ |
`token` | *null* \| *string* |

**Returns:** *void*

Defined in: [src/authStore.ts:138](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L138)

___

### reAuthenticate

▸ **reAuthenticate**(`force?`: *boolean*, `tokenExpires?`: *number*): *Promise*<*any*\>

#### Parameters:

Name | Type | Default value |
------ | ------ | ------ |
`force` | *boolean* | false |
`tokenExpires` | *number* | 0 |

**Returns:** *Promise*<*any*\>

Defined in: [src/authStore.ts:185](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L185)

___

### save

▸ **save**(): *void*

**Returns:** *void*

Defined in: [src/authStore.ts:134](https://github.com/ps73/reactive-feathers-state/blob/aac03ee/src/authStore.ts#L134)
