@faable/auth-sdk 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/README.md +46 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -11,8 +11,54 @@
11
11
  </a>
12
12
  </p>
13
13
 
14
+ Programmatically perform FaableAuth administrative tasks though our REST API.
15
+
16
+ > ⚠️ Use server side only. Otherwise administrative credentials may be exposed in client side.
17
+
14
18
  ## Install
15
19
 
16
20
  ```bash
17
21
  npm install @faable/auth-sdk
18
22
  ```
23
+
24
+ ## Config
25
+
26
+ ```js
27
+ import { FaableAuthApi } from "@faable/auth-sdk";
28
+ import { createClientCredentials } from "@faable/sdk-base";
29
+
30
+ const auth = createClientCredentials();
31
+
32
+ const api = FaableAuthApi.create({
33
+ auth,
34
+ team: "<faable_team_id>",
35
+ });
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ Get user:
41
+
42
+ ```js
43
+ const user = await api.getUser("<user_id>");
44
+ ```
45
+
46
+ Update user:
47
+
48
+ ```js
49
+ const updated_user = await api.updateUser("<user_id>", {
50
+ phone: "+34XXXXXXXXX",
51
+ });
52
+ ```
53
+
54
+ List users:
55
+
56
+ ```js
57
+ // Returns first page of latest 30 users
58
+ const users = await api.listUsers().first();
59
+ ```
60
+
61
+ ```js
62
+ // Query users with email=demo@example.com
63
+ const users = await api.listUsers({ email: "demo@example.com" }).first();
64
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/auth-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "author": "Marc Pomar <marc@faable.com>",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",