Spanish Total.js
English
Documentation For AI agents
Contents

Run in production

Prepare OpenAuth for a public server: HTTPS, the right address, release mode.

.md GitHub
On this page

OpenAuth holds your provider secrets and hands out access tokens, so the server needs some care before users reach it.

Set the primary access token

Do it before anything else. See Protect the admin interface.

Use HTTPS

Tokens, sign-in codes and profiles travel through OpenAuth. Put it behind a reverse proxy (for example Nginx or Caddy) that serves HTTPS, and let your apps and users use the https:// address only.

Pass the public address to OpenAuth

OpenAuth builds the sign-in address and the callback endpoint from the address of each request. Behind a reverse proxy, forward the original host and protocol, or providers reject the callback. With Nginx:

location / {
    proxy_pass http://127.0.0.1:8000;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
}

Then check that Configure in Extensions shows the https:// callback endpoint, and that POST / answers with an https:// sign-in address.

Listen only on the local address

By default OpenAuth listens on all network interfaces. When the reverse proxy runs on the same server, make OpenAuth listen only on 127.0.0.1. In index.js, change the line

// options.ip = '127.0.0.1';

to

options.ip = '127.0.0.1';

and restart OpenAuth. With Docker, publish the port only on the local address instead:

docker run -d --name openauth -p 127.0.0.1:8000:8000 -v openauth:/www openauth

Start in release mode

npm start runs in debug mode. On a server, start OpenAuth in release mode:

node index.js 8000 --release

Restrict the admin interface

Your apps need only /, /login/, /oauth/ and /sessions/. If you can, allow /setup/ and /api/ only from your own network in the reverse proxy.

One token per app

Give each app its own app token, and remove the token of an app you retire.

Back up

Copy the data folder on a schedule. See Back up your data.

Made in Europe