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 https 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.
The app can listen on your machine. The callback you register cannot. Register
https:// on a public host, such as https://myapp.example/callback.
http://, localhost, 127.0.0.1, [::1], and a private network address are
rejected.
Prerequisites
- An approved Login client. For the steps, see Register an application.
- The login button kit, for the button that starts login.
- A public https callback that reaches the app, including its port and path.
To get one, run a tunnel that gives your dev server a public https address. Register that address and your callback path as the callback. Open the app through the tunnel address too, so login starts and ends on the same origin. The tunnel host must be public, not one of the rejected names above.
Steps
-
Choose an exact public callback:
https://myapp.example/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
http://,localhost, a loopback address, a private address, and a wildcard are not valid callbacks.- Register the exact https URL, with its port and path.
For the storage choices, see Token storage.
