Skip to content

Commit 18e490a

Browse files
committed
Update docs
1 parent 29c2341 commit 18e490a

3 files changed

Lines changed: 59 additions & 15 deletions

File tree

docs/authentication.md

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,10 @@ RUN make && make install
3131
WORKDIR /var/lib/postgresql
3232
```
3333

34-
Then rebuild:
34+
Then rebuild the Postgres imageand recreate the container:
3535

3636
```sh
3737
docker compose build postgres
38-
```
39-
40-
And recreate the running container:
41-
42-
```sh
4338
docker compose up -d postgres
4439
```
4540

@@ -249,14 +244,57 @@ applied.
249244
Add the auth schema to Postgres in `compose.yaml`:
250245

251246
```yaml
252-
PGRST_DB_SCHEMAS: api,auth
247+
postgrest:
248+
environment:
249+
PGRST_DB_SCHEMAS: api,auth
250+
```
251+
252+
And recreate the PostgREST container:
253+
254+
```sh
255+
docker compose up -d postgrest
256+
```
257+
258+
## ✅ Usage
259+
260+
To use the `auth` schema, requests [must include a
261+
header](https://docs.postgrest.org/en/stable/references/api/schemas.html#multiple-schemas).
262+
263+
GET and HEAD requests should include the header:
264+
265+
```
266+
Accept-Profile: auth
253267
```
254268

255-
✅ Usage
269+
Other methods (POST, PATCH, PUT and DELETE) should include:
256270

257-
Explain that all auth endpoints must have a certain header.
271+
```
272+
Content-Profile: auth
273+
```
274+
275+
### Examples
276+
277+
Login:
278+
279+
```sh
280+
curl \
281+
-H "Content-Profile: auth" \
282+
-H "Content-Type: application/json" \
283+
--data '{"user_": "demo", "pass": "demo"}' \
284+
http://localhost/rpc/login
285+
```
258286

259-
Show example of using each endpoint.
287+
Get the refresh token inserted when logged in:
288+
289+
```sh
290+
bin/postgres psql -c 'select token from auth.refresh_token order by created_at desc limit 1'
291+
```
292+
293+
Refresh the access token and extract the new token from the Set-Cookie header:
294+
295+
```sh
296+
export ACCESS_TOKEN=$(curl --silent -i -X POST -H 'Cookie: refresh_token='$REFRESH_TOKEN'; HttpOnly' http://localhost/rpc/refresh_token |sed -nE 's/^Set-Cookie: access_token=([^;]*).*/\1/p')
297+
```
260298

261299
- POST-ing a user.
262300
- `/rpc/login`

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
# SuperStack
44

5-
_SuperStack_ is a lightweight, modular backend powered by PostgreSQL —
6-
perfect for indie developers, SaaS builders, and teams who want full
7-
rontrol without the bloat.
5+
_SuperStack_ is a lightweight, modular backend powered by PostgreSQL — perfect
6+
for indie developers, SaaS builders, and teams who want full control without
7+
the bloat.
88

99
Spin up a fully working backend in seconds, with zero setup. Just clone and
1010
run.

docs/rabbitmq.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ RUN apt-get update && apt-get install -y \
2020
# pg_amqp - Used by api schema
2121
COPY ./pg_amqp /pg_amqp
2222
WORKDIR /pg_amqp
23-
RUN make
24-
RUN make install
23+
RUN make && make install
2524

2625
WORKDIR /var/lib/postgresql
2726
```
2827

28+
Then rebuild the Postgres imageand recreate the container:
29+
30+
```sh
31+
docker compose build postgres
32+
docker compose up -d postgres
33+
```
34+
2935
> You may need to fix "implicit int" errors in pg_amqp, which were reported
3036
> [here](https://github.com/omniti-labs/pg_amqp/issues/41), and [fixed but not
3137
> yet merged](https://github.com/omniti-labs/pg_amqp/pull/43).

0 commit comments

Comments
 (0)