bwh-auth 0.3.2 → 0.4.0
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 +30 -0
- package/dist/index.cjs +538 -61
- package/dist/index.d.cts +72 -2
- package/dist/index.d.ts +72 -2
- package/dist/index.js +536 -61
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ The companion Laravel API package is
|
|
|
22
22
|
- `TwoFactorForm`
|
|
23
23
|
- `PasskeyLoginButton`
|
|
24
24
|
- `PasskeySection`
|
|
25
|
+
- `ApiCredentialsSection`
|
|
25
26
|
|
|
26
27
|
## Relying-party helpers
|
|
27
28
|
|
|
@@ -169,6 +170,10 @@ import { SignupForm, registerPasskey } from 'bwh-auth'
|
|
|
169
170
|
/>
|
|
170
171
|
```
|
|
171
172
|
|
|
173
|
+
Within `LoginForm`, explicit passkey login cancels and waits for conditional autofill before requesting a credential. Password submission and unmount also cancel pending passkey authentication. Autofill pauses after a manual sign-in attempt until the form is remounted. Changing consumer callbacks does not restart autofill.
|
|
174
|
+
|
|
175
|
+
When `PasskeyLoginButton` receives `onError`, the consumer owns error display; without it, the button displays its own error.
|
|
176
|
+
|
|
172
177
|
Consumers can preserve app-specific login state and design-system checkboxes
|
|
173
178
|
without rebuilding the form:
|
|
174
179
|
|
|
@@ -202,6 +207,31 @@ The explicit passkey button and conditional autofill both default to the Laravel
|
|
|
202
207
|
/>
|
|
203
208
|
```
|
|
204
209
|
|
|
210
|
+
## API credentials
|
|
211
|
+
|
|
212
|
+
`ApiCredentialsSection` lets a signed-in person create credentials for apps that use the API:
|
|
213
|
+
- **API tokens**, for connectors that ask for a key;
|
|
214
|
+
- **OAuth apps**, for connectors that run the authorization-code flow.
|
|
215
|
+
|
|
216
|
+
It talks to the auth package's credential service (`oauth_server.credentials`) through its JSON index URL. The server sends every action URL, so the component assembles none.
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
<ApiCredentialsSection
|
|
220
|
+
indexUrl="/account/api-credentials"
|
|
221
|
+
components={components}
|
|
222
|
+
links={[
|
|
223
|
+
{ label: 'OpenAPI document', url: openApiUrl },
|
|
224
|
+
{ label: 'OAuth authorize URL', url: authorizeUrl },
|
|
225
|
+
{ label: 'OAuth token URL', url: tokenUrl },
|
|
226
|
+
]}
|
|
227
|
+
/>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
- **Each new secret is shown once.** It comes from the creation response and is kept only in component memory. Afterwards only the lists are reloaded, so it never enters page props or history.
|
|
231
|
+
- **Requests** send the session cookie and `X-CSRF-TOKEN`. A 401 or 419 response becomes "sign in again".
|
|
232
|
+
- **While the server reports issuing unavailable** (OAuth switched off), the create forms are hidden, and revoke and delete still work.
|
|
233
|
+
- **Token lifetimes** are ISO-8601 durations from the server, displayed as text (`PT4H` shows as "4 hours").
|
|
234
|
+
|
|
205
235
|
## Endpoint Defaults
|
|
206
236
|
|
|
207
237
|
Auth forms default to the Laravel package API routes where the Laravel package owns the endpoint:
|