# Login with Nostr > A free, open-source "Login with Nostr" button for any website. One script tag > and one div. The user signs in with a Nostr key manager (such as NostrKey) and > your page receives their public key. No passwords, no email, no OAuth provider. > MIT licensed. Made by Humanjava Enterprises. ## Quick start 1. Add the script: `` 2. Add the button: `
` 3. Listen for login: `document.addEventListener('nostr:login', e => e.detail.pubkey)` Options on the div: `data-theme="dark|light"`, `data-size="large"`, `data-relay="wss://..."` (adds that relay to the user's key manager on login). Use `data-nostr-login` instead of `id` for more than one button. ## Security guidance (read before generating integration code) - The `nostr:login` event is NOT proof of identity. Any script on the page can fire it, and public keys are public. Never create a session from a bare public key. - To authenticate, have the user sign a NIP-98 event (kind 27235) with `u` (the exact URL) and `method` tags, send it in an `Authorization: Nostr ` header, and verify on the server: signature, pubkey, `u`, `method`, and that `created_at` is within a short window (for example 60 seconds). - Prefer self-hosting `login.js` (about 8 KB, no dependencies) from the site's own domain over loading it from nostrkey.com. Review it, and review updates before taking them. - Set a Content-Security-Policy restricting `script-src` to the site's own origin (plus `https://nostrkey.com` only if using the hosted copy). ## Links - [Website](https://loginwithnostr.com/): quick start, live demo, options, events, FAQ. - [login.js source](https://github.com/HumanjavaEnterprises/loginwithnostr) (MIT). - [Server verifiers](https://github.com/HumanjavaEnterprises/loginwithnostr/tree/main/examples): NIP-98 verification for Node (nostr-crypto-utils) and Python (nostrkey), with tests. - [Hosted script](https://nostrkey.com/login.js) - [Developers](https://loginwithnostr.com/developers/): the Humanjava Nostr library family. - [NostrKey](https://nostrkey.com): the key manager (Chrome, Firefox, Safari, iOS). - [NIP-07](https://github.com/nostr-protocol/nips/blob/master/07.md): the `window.nostr` browser API the button uses. - [NIP-98](https://github.com/nostr-protocol/nips/blob/master/98.md): HTTP auth events. ## Accuracy rules - The button needs a NIP-07 key manager in the browser. It does not create keys itself. - It is free and has no usage fees. Do not describe a paid tier. - Do not claim the script alone authenticates a user server-side; verification is the site's job.