@fluid-app/fluid-cli 0.1.64 → 0.1.65

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 CHANGED
@@ -25,6 +25,48 @@ fluid logout # Remove stored authentication
25
25
 
26
26
  Profiles are stored at `~/.fluid/config.json`.
27
27
 
28
+ `--shop <shop>` signs in to one company (`acme` or `acme.fluid.app`). For an
29
+ admin, finishing the sign-in with a code sent for that shop also confirms a
30
+ new company's signup.
31
+
32
+ ### Without a terminal
33
+
34
+ `fluid login` asks for the email and code at a prompt, so a script or agent
35
+ with no terminal signs in in two steps instead:
36
+
37
+ ```bash
38
+ # 1. Email a code for one company and save the sign-in (prints how to finish)
39
+ fluid login --send-code --email maya@acme.test --shop acme
40
+
41
+ # 2. Finish with the emailed code from FLUID_LOGIN_CODE
42
+ FLUID_LOGIN_CODE=123456 fluid login --code --email maya@acme.test --yes
43
+
44
+ # or read it from stdin with --code -
45
+ echo 123456 | fluid login --code - --email maya@acme.test --yes
46
+ ```
47
+
48
+ Step 1 needs `--shop`: the code is tied to that company, and only such a
49
+ code confirms a new signup (the signup response names the shop as
50
+ `fluid_shop`). Step 2 signs in to the same company; a `--shop` given there
51
+ must match it.
52
+
53
+ The code expires after 30 minutes, and five wrong codes lock it. Step 1
54
+ saves the server's id for the sign-in under
55
+ `~/.fluid/pending-logins/` until step 2 finishes it; the id alone cannot
56
+ sign in. A code given as `--code 123456` works but is visible in shell
57
+ history.
58
+
59
+ Without a terminal (and with `--code -`, which takes stdin), step 2 needs
60
+ `--yes`, which replaces a profile named after the company, or `--name
61
+ <profile>`, which is refused before the code is spent if that profile
62
+ exists. Either way the code is never used up on a profile it cannot write.
63
+ `--json` prints one JSON object (`status` is `code_sent`, `signed_in` or
64
+ `error`, with a `code` on errors).
65
+
66
+ With no terminal, `fluid login` fails at once rather than waiting at a
67
+ prompt, unless it has a token (`--token` or `FLUID_TOKEN`) or runs one of
68
+ the two steps (`--send-code`, `--code`).
69
+
28
70
  ## Plugins
29
71
 
30
72
  Install plugins alongside the core CLI to add commands:
@@ -102,6 +144,7 @@ to turn it off.
102
144
  | Variable | Description |
103
145
  | ----------------------- | ------------------------------------------------ |
104
146
  | `FLUID_TOKEN` | API token (alternative to `fluid login`) |
147
+ | `FLUID_LOGIN_CODE` | Emailed code read by `fluid login --code` |
105
148
  | `FLUID_API_BASE` | API base URL (default: `https://api.fluid.app`) |
106
149
  | `FLUID_CONFIG_DIR` | Override config directory (default: `~/.fluid/`) |
107
150
  | `FLUID_NO_UPDATE_CHECK` | Turn off the daily update notice |