> **Source:** https://knowledge.leegality.com/document-execution/api/sdks/authentication > **Site:** Leegality Knowledge Base — https://knowledge.leegality.com > **About:** Leegality is a document execution platform covering eSigning, stamps, NeSL, workflows, and REST API integration. > **Navigation:** Every article on this site has a plain-text version at `.txt` (this format). To get an index of all articles with their `.txt` links, read: https://knowledge.leegality.com/llms.txt > **AI Guide:** For instructions on how to navigate this knowledge base as an AI agent, read: https://knowledge.leegality.com/ai-readable.txt --- # Sender Login When you set `auth: true` in `journeyOptions`, the sender must log in to their Leegality account inside the popup before the journey starts. This is the stronger of the two authentication paths — the sender actively proves their identity, rather than relying on the signed URL alone. ## When to use it | `auth` | What happens | Security level | |---|---|---| | `false` (default) | The signed URL is the credential. Whoever holds the URL can open the journey immediately. | The client vouched for this sender when it created the draft. | | `true` | The sender must log in. `email` is **required** — the API rejects the draft without it. The account they log into must match this email. | The sender actively proves their identity. | Use `auth: true` when you need to confirm the person at the keyboard is the intended sender — not just someone who obtained the link. ## What happens inside the popup The entire login flow happens **inside the popup window** and is handled entirely by Leegality. Your page does nothing — no redirects, no token management, no extra code. Here is what happens step by step: 1. The SDK opens the popup with the signed URL. 2. The popup calls Leegality's boot endpoint. Because `auth: true` is encoded in the URL, the boot response comes back with `outcome: "AUTHENTICATION_REQUIRED"` instead of `outcome: "AUTHENTICATED"`. 3. The popup shows a login screen with the `email` from `journeyOptions` pre-filled and **uneditable**. 4. The sender chooses **password** or **OTP** to authenticate. 5. If the email has no existing Leegality account, the OTP path auto-creates one. 6. On successful login, the SDK transitions to the Create step and the journey begins. ## What your code needs to do Nothing. The `auth` option is set at draft creation and the rest is automatic. Note that `email` is **required** when `auth` is `true` — the API rejects the request without it. ```json { "workflowId": "", "journeyOptions": { "auth": true, "email": "sender@example.com" } } ``` Your `onEvent` callback works identically whether `auth` is `true` or `false`. The events are the same — the only difference is that the sender sees a login screen before the journey starts. ## Login failures If the sender enters wrong credentials or cancels the login flow, the SDK fires an `ERROR` event with one of these codes: | errorCode | When it fires | |---|---| | `access_denied` | The sender cancelled the login flow. | | `auth_failed` | The login returned with a state mismatch or missing code. | | `invalid_grant` | The OAuth token exchange failed (e.g. expired or reused authorization code). | If the sender closes the tab on the login page instead, the SDK fires a [`CANCELLED`](https://knowledge.leegality.com/document-execution/api/sdks/events#cancelled) event. ## Email enforcement When `auth: true` is set with an `email`, the boot endpoint verifies that the logged-in account matches the email encoded in the signed URL. If they do not match, the boot call returns a 403 and the journey does not start. This means: - The `email` field pre-fills the login form and is **uneditable** — the sender cannot type a different address. - If the sender somehow logs in with a different account, the 403 stops them. ## Re-issue warning When you [re-issue a URL](https://knowledge.leegality.com/document-execution/api/sdks/draft-api#re-issue-a-url), the `auth` option is **not** remembered from the original create call. If you omit it on re-issue, it falls back to the department default (typically `false`), meaning anyone with the new URL can open the journey without logging in. Always re-supply `auth: true` when re-issuing URLs for drafts that require sender login.