loginos

Get started

Build with AI

Ready-made prompts and machine-readable docs for Claude Code, Codex, Cursor and other coding agents.

loginos is documented for coding agents as well as for people. Point Claude Code, Codex, Cursor or any other agent at the machine-readable docs, or give it one of the ready-made prompts below. In the developer console, the same prompts come with your app key and callback URLs already filled in.

~/your-app

$

1/4Give your agent one prompt, or one of the ready-made ones below.

Docs for agents

AddressWhat it is
/llms.txtAn index of these docs in the llms.txt format.
/llms-full.txtAll of the docs in one Markdown file.
/docs/<page>.mdAny page as Markdown, like /docs/link-accounts.md.
/api/v1/openapi.jsonThe Management API as OpenAPI 3.1.
/.well-known/openid-configurationOpenID Connect discovery.

Every page of these docs has Copy page, Markdown and Ask Claude buttons at the top, too.

Prompts

Run your agent in your project’s folder and paste one of these. They name the docs to read, the security rules that matter, and what to show you at the end. Replace YOUR_APP_KEY and the callback URL, or copy them from the console where they are filled in. None of them contains your secret: the agent reads it from your environment.

Add “Sign in with loginos”

The redirect flow with PKCE, a callback that exchanges the code, and your own session.

Add "Sign in with loginos" to this app.

Read https://loginos.io/docs/quickstart.md first and follow it exactly.

- loginos: https://loginos.io (OpenID Connect, discovery at https://loginos.io/.well-known/openid-configuration)
- App key (client_id): YOUR_APP_KEY. Read it from LOGINOS_APP_KEY.
- App secret: read it from LOGINOS_APP_SECRET on the server. Never send it to the browser or commit it.
- Registered callback URL: https://your-app.example/api/auth/login/single/callback

- Use the authorization code flow with PKCE (S256) and a state value, both kept in an HttpOnly cookie or the server session.
- In the callback, check state, then POST the code, redirect_uri and code_verifier to https://loginos.io/oauth/token with the app key and secret.
- The response has a "user" object (sub, preferred_username, name, picture, email, roles, permissions). Find or create the local user by "sub" and start this app's own session.
- Keep the existing sign-in methods working.

When you're done, list the files you changed and tell me exactly how to test it.

A “Link loginos” button in account settings for people who already have an account with you.

One-tap “Continue as”

The browser’s own prompt on your pages, with a small window as the fallback.

Add one-tap "Continue as …" sign-in with loginos to this app's pages, without redirecting people away.

Read https://loginos.io/docs/continue-as.md first and follow it exactly.

- loginos: https://loginos.io (OpenID Connect, discovery at https://loginos.io/.well-known/openid-configuration)
- App key (client_id): YOUR_APP_KEY. Read it from LOGINOS_APP_KEY.
- App secret: read it from LOGINOS_APP_SECRET on the server. Never send it to the browser or commit it.
- Registered callback URL: https://your-app.example/api/auth/login/single/callback

- Load https://loginos.io/sdk/v1.js and call Loginos.init({ appKey }) on pages where signed-out people land.
- Call prompt() on page load and signIn() from a button click. Both resolve to { code, nonce, via } or null.
- POST the result to a new server route that exchanges the code at https://loginos.io/oauth/token (no redirect_uri, no code_verifier), checks that the ID token's nonce matches, and starts this app's session from the "user" object.
- Call signOut() before signing someone out.

When you're done, list the files you changed and tell me exactly how to test it.

Use roles and permissions

Read roles from tokens, guard routes by permission, and change roles from your server.

Use loginos roles and permissions for authorization in this app.

Read https://loginos.io/docs/roles.md and https://loginos.io/docs/api.md first.

- loginos: https://loginos.io (OpenID Connect, discovery at https://loginos.io/.well-known/openid-configuration)
- App key (client_id): YOUR_APP_KEY. Read it from LOGINOS_APP_KEY.
- App secret: read it from LOGINOS_APP_SECRET on the server. Never send it to the browser or commit it.
- Registered callback URL: https://your-app.example/api/auth/login/single/callback

- Tokens and the "user" object from https://loginos.io/oauth/token carry "roles" and "permissions" (arrays of keys). Store them in the session at sign-in.
- Add a small helper like can(user, "posts:publish") and use it to guard the routes and buttons that need it.
- Where this app changes someone's role, call PUT https://loginos.io/api/v1/users/{sub}/roles with {"roles": [...]} and HTTP Basic auth (app key and secret). Roles show up in tokens from the next sign-in.

When you're done, list the files you changed and tell me exactly how to test it.

Add new domains automatically

An endpoint that tells loginos which new domains are yours, so they work the first time someone signs in.

This app runs on more domains than I want to register one by one with loginos (customers connect their own domains, new brands come and go). Add the endpoint loginos calls to ask whether a domain it hasn't seen yet belongs to this app.

Read https://loginos.io/docs/domains.md first and follow it exactly.

- loginos: https://loginos.io (OpenID Connect, discovery at https://loginos.io/.well-known/openid-configuration)
- App key (client_id): YOUR_APP_KEY. Read it from LOGINOS_APP_KEY.
- App secret: read it from LOGINOS_APP_SECRET on the server. Never send it to the browser or commit it.
- Registered callback URL: https://your-app.example/api/auth/login/single/callback

- Add a POST route, for example /api/loginos/domain-check. loginos sends JSON: {"host": "shop.customer.example", "client_id": "YOUR_APP_KEY"}.
- Answer 200 with {"host": <the same host>, "allow": true} only when this app's own records say the host is one of its domains (for example an active custom domain in the database). Otherwise answer 200 with {"host": <the same host>, "allow": false}.
- Never answer yes to everything, and never decide from the host's name, its DNS records or the request's Host header: the app key is public, so look-alike sites can send people to loginos with it.
- Answer within 3 seconds, without redirects, and without needing a session, cookies or a CSRF token.
- Tell me the full https URL of the route, so I can turn on "Add new domains automatically" in the loginos console (Domains tab).

When you're done, list the files you changed and tell me exactly how to test it.

From the terminal

Each prompt is also served as plain text, so a terminal agent can take it directly:

claude "$(curl -fsSL https://loginos.io/docs/prompts/sign-in.txt)"

The other prompts are at /docs/prompts/link.txt, /docs/prompts/continue-as.txt and /docs/prompts/roles.txt.

Teach your agent about loginos

Add this to AGENTS.md, CLAUDE.md or your agent’s rules file, so every session knows how sign-in works in your project:

AGENTS.md
## Sign-in: loginos

This app signs people in with loginos (OpenID Connect). Docs for agents: https://loginos.io/llms.txt

- App key in LOGINOS_APP_KEY. App secret in LOGINOS_APP_SECRET: server only, never in client code, logs or commits.
- Authorization code flow with PKCE and state. Codes are exchanged at https://loginos.io/oauth/token on the server.
- People are identified by `sub`. Linked accounts also carry this app's own user id as `external_id`.
- Roles and permissions come in tokens. Check permissions, not roles.
- Never match or merge accounts by email: loginos doesn't verify email addresses yet.

Good practice with agents

  • Review the change before you run it, especially the callback: it must check state, and for linking, compare user.external_id with the signed-in user.
  • Keep the app secret out of the conversation. If you pasted it somewhere by mistake, rotate it in the console’s Settings.
  • Test with a second domain from your platform: the same account should come straight back without asking again.