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
- An approved Login client. For the steps, see Register an application.
- A loopback port and path that your app listens on.
- The login button kit, for the button that starts login.
Steps
-
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 -
Register that callback URL on the Login client.
-
Open the authorization request in the system browser, not in an embedded web view.
-
Complete the code exchange as in Add login without a library.
-
Store the access token on the device.
-
If the response includes a refresh token, store it in the operating system credential store.
-
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.
localhostand127.0.0.1are different origins. Register the callback that the app uses.
For the storage choices, see Token storage.
