# Microservices authentication client

Client to authenticate Duda's microservices' clients

## Usage
```javascript
import { create } from '@dudadev/ms-client-auth';

const auth = create();

function authListener(authDetails) {
	console.log(`Auth token: ${authDetails.value}`);
}

// Listen to auth changes
const cancelListener = auth.onAuth(authListener);
// Stop listening
cancelListener();

// Trigger authentication on demand
auth.authenticateServices()

// Set an interval to perform periodic authentication
auth.setAutoAuthInterval(5000); // This will cause the authenticator to authenticate every 5 seconds
// You can also create an auth instance with the interval
auth = create({ autoAuthInterval: 5000 });
```
