28 lines
949 B
Markdown
28 lines
949 B
Markdown
# PocketBase Test User Creation
|
|
|
|
Quick test accounts for local development — no admin auth needed if the users collection allows public creation.
|
|
|
|
## Create user
|
|
|
|
```bash
|
|
curl -s -X POST http://127.0.0.1:8091/api/collections/users/records \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"email":"demo@shop.com","password":"test1234","passwordConfirm":"test1234","emailVisibility":true}'
|
|
```
|
|
|
|
## Verify login
|
|
|
|
```bash
|
|
curl -s -X POST http://127.0.0.1:8091/api/collections/users/auth-with-password \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"identity":"demo@shop.com","password":"test1234"}'
|
|
```
|
|
|
|
Returns a JWT `token` on success. Use the token in `Authorization: Bearer <token>` for authenticated requests.
|
|
|
|
## Notes
|
|
|
|
- If public creation is disabled, authenticate as admin first and use the admin token
|
|
- `passwordConfirm` must match `password` exactly
|
|
- `emailVisibility: true` makes the email visible in record listings and API responses
|