Skip to content

Authentication and sessions

Add login to a local app

Add RemiliaNET login to a local browser app or a desktop app with a public Login client and an exact loopback callback.

The app needs no backend and no client secret. A Chromium extension uses its own callback instead. For an extension, see Add login to a Chromium extension.

A personal local script that needs app-only access can use an API client instead. The script stores its secret in the operating system credential store of the user. No browser app or distributed desktop app ships an API client secret.

Prerequisites

Steps

  1. Choose an exact loopback callback with its port and path:

    http://localhost:3000/callback
    http://127.0.0.1:3000/callback
    http://[::1]:3000/callback
  2. Register that callback URL on the Login client.

  3. Open the authorization request in the system browser, not in an embedded web view.

  4. Complete the code exchange as in Add login without a library.

  5. Store the access token on the device.

  6. If the response includes a refresh token, store it in the operating system credential store.

  7. Clear the local tokens when the user logs out.

Result

Users log in on the RemiliaNET login page. Your app receives its own tokens for the permissions granted to it.

A closed browser window does not show whether the user approved or canceled. A feature stays disabled until your app receives the callback and exchanges the code.

Troubleshooting

  • A local network address or a wildcard address is not a valid callback for a local app. Register the exact loopback callback.
  • localhost and 127.0.0.1 are different origins. Register the callback that the app uses.

For the storage choices, see Token storage.