UU Networking Sample API

Local backend for the UUSwiftNetworking and UUKotlinNetworking sample apps.

Authentication

Open this server's auth gateway in ASWebAuthenticationSession. This server is using the SSO auth provider, so login redirects to Silverpine SSO with server-managed PKCE.

https://uu-networking.spsw.io/api/auth/login?redirect_uri=uu-networking%3A%2F%2Flogin

The app receives a one-time ticket on its callback, then exchanges it with POST /api/auth/complete for this API's bearer token and refresh token.

Send Authorization: Bearer <token> on protected routes. Normal API routes accept only tokens issued by this server.

Endpoints

GET  /health
GET  /docs
GET  /test/as-web-auth?redirect_uri=...
POST /test/as-web-auth?redirect_uri=...
GET  /api/auth/login?redirect_uri=...
GET  /api/auth/callback
POST /api/auth/complete
POST /api/auth/refresh
GET  /api/me
GET  /api/notes
PUT  /api/notes
DELETE /api/notes
GET  /api/notes/{id}
PUT  /api/notes/{id}
DELETE /api/notes/{id}
GET  /api/config/{key}
PUT  /api/config/{key}
DELETE /api/config/{key}
GET  /api/configs
PUT  /api/configs
DELETE /api/configs

Full API reference: docs/API.md in the repository. Interactive docs: /api-docs (OpenAPI / Swagger UI).

ASWebAuthenticationSession test

Open this URL from ASWebAuthenticationSession with your app callback as redirect_uri, then tap the page button. The server will respond with 302 to that callback URI, echoing extra query params onto the callback.

https://uu-networking.spsw.io/test/as-web-auth?redirect_uri=uu-networking%3A%2F%2Flogin&ticket=foobar&state=baz

Add csp=1, csp=2, csp=3, x_frame_options=DENY, or cors=1 to test those response headers without echoing them to the callback. csp=2 allows the callback scheme or origin in form-action; csp=3 mirrors the SSO server page policy with form-action 'self' on the initial page and omits CSP from the redirect response.

Sample flow

curl https://uu-networking.spsw.io/health

curl https://uu-networking.spsw.io/api/me \
  -H "Authorization: Bearer ACCESS_TOKEN"

curl https://uu-networking.spsw.io/api/notes/note-1 \
  -X PUT \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id":"note-1","title":"Hello","body":"From the sample app"}'

curl https://uu-networking.spsw.io/api/configs \
  -X PUT \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{"key":"theme","value":"dark"},{"key":"locale","value":"en-US"}]'