fauxbase-cli 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -714,6 +714,32 @@ const fb = createClient({
|
|
|
714
714
|
});
|
|
715
715
|
```
|
|
716
716
|
|
|
717
|
+
### Authentication
|
|
718
|
+
|
|
719
|
+
When `auth` is configured, STOMP automatically injects `Authorization: Bearer <token>` into connection headers. Both SSE and STOMP reconnect on login/logout so the connection always uses the current token.
|
|
720
|
+
|
|
721
|
+
```ts
|
|
722
|
+
const fb = createClient({
|
|
723
|
+
driver: { type: 'http', baseUrl: '/api' },
|
|
724
|
+
services: { todo: TodoService },
|
|
725
|
+
auth: UserAuth,
|
|
726
|
+
events: {
|
|
727
|
+
source: {
|
|
728
|
+
type: 'stomp',
|
|
729
|
+
brokerUrl: 'wss://api.example.com/ws',
|
|
730
|
+
subscriptions: { '/topic/todos': 'todo' },
|
|
731
|
+
// No need to set connectHeaders — token is injected automatically
|
|
732
|
+
},
|
|
733
|
+
},
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
// After login, STOMP reconnects with the new token
|
|
737
|
+
await fb.auth.login({ email: 'alice@test.com', password: 'secret' });
|
|
738
|
+
|
|
739
|
+
// After logout, STOMP reconnects without token
|
|
740
|
+
fb.auth.logout();
|
|
741
|
+
```
|
|
742
|
+
|
|
717
743
|
### Custom handlers
|
|
718
744
|
|
|
719
745
|
```ts
|