Skip to main content

:LovelaceAuth

Authenticate with Lovelace using the OAuth 2.0 device authorization flow.

Command Signature

vim
:LovelaceAuth

Alias: :LAuth

Description

The :LovelaceAuth command manages authentication with the Lovelace platform. It displays your current authentication status or initiates the device authorization flow if you're not authenticated.

What it does:

  • Checks current authentication status
  • Initiates device authorization flow if needed
  • Displays user account information
  • Manages authentication tokens

When to use:

  • First-time setup after installation
  • When authentication has expired
  • To verify current authentication status
  • After daemon restart

Usage

Check Authentication Status

vim
:LovelaceAuth

If already authenticated, displays your account information in a split window.

Initiate Device Flow

vim
:LovelaceAuth

If not authenticated, opens the device authorization interface with user code and verification URL.

From Lua

lua
require("lovelace.commands").auth()

Output Format

When Already Authenticated

# Authentication Status

**User**: user@example.com
**User ID**: usr_abc123def456
**Device**: Paired
**Session**: Active

Press 'q' to close

Keybinding: Press q to close the window

Device Authorization Flow

# Device Authorization Required

To authorize this device, visit:
https://uselovelace.com/device

And enter code: ABCD-EFGH

Keybindings:
  c - Copy code to clipboard
  o - Open browser to verification URL
  q - Cancel authentication

Waiting for authorization...

Device Flow Keybindings

While the device authorization window is open:

KeyActionDescription
cCopy codeCopy user code to clipboard
oOpen browserOpen verification URL in default browser
qCancelCancel authentication and close window

Workflow:

  1. Press c to copy the code
  2. Press o to open browser (or manually visit URL)
  3. Paste code in browser and authorize
  4. Window closes automatically when successful

Device Code Expiration

Device codes expire after 10 minutes. If the code expires before you complete authorization:

✗ Device code expired. Please try again.

Solution: Run :LovelaceAuth again to generate a new code.

Authentication Flow Walkthrough

Step 1: Check Current Status

vim
:LovelaceAuth

If authenticated: Shows account info, done!

If not authenticated: Proceeds to device flow

Step 2: Copy User Code

Device flow window appears:

And enter code: ABCD-EFGH

Keybindings:
  c - Copy code to clipboard

Press c to copy the code to clipboard.

Step 3: Open Verification URL

Keybindings:
  o - Open browser to verification URL

Press o to open https://uselovelace.com/device in your default browser.

Alternative: Manually visit the URL if o doesn't work.

Step 4: Authorize in Browser

  1. Browser opens to verification page
  2. Paste the code (Cmd+V or Ctrl+V)
  3. Click "Authorize"
  4. Confirm the device authorization

Step 5: Wait for Completion

Back in Neovim:

Waiting for authorization...

The extension polls for authorization every 5 seconds.

Automatic completion:

  • Window closes when authorization succeeds
  • Notification: "Authentication successful! Welcome to Lovelace."

Step 6: Verify Authentication

vim
:LovelaceAuth

Should now show your account information.

Troubleshooting

Authorization Not Completing

Symptom: Device flow window stays open, "Waiting for authorization..." doesn't change

Solutions:

  1. Verify browser authorization:

    • Check you clicked "Authorize" in the browser
    • Look for error messages in the browser
    • Ensure the code matches exactly
  2. Check internet connection:

    • Device flow requires internet access
    • Firewall may be blocking OAuth endpoints
    • Try disabling VPN temporarily
  3. Try manual authorization:

    bash
    # Visit URL manually
    open https://uselovelace.com/device
    
    # Enter code manually from device flow window
    
  4. Enable debug logging:

    lua
    require("lovelace").setup({
      log_level = "debug"
    })
    

    Then check :messages for authorization polling logs.

"Authentication failed" Error

Symptom: Error notification after device flow completes

Solutions:

  1. Verify account status:

  2. Check daemon logs:

    bash
    localhost-ctl logs | grep auth
    
  3. Restart authentication:

    vim
    :LovelaceAuth
    

Browser Doesn't Open

Symptom: Pressing o doesn't open browser

Solutions:

  1. Manually visit URL:

    • URL is shown in the device code window
    • Copy and paste into browser
  2. Check default browser configuration:

    bash
    # macOS
    open https://uselovelace.com/device
    
    # Linux
    xdg-open https://uselovelace.com/device
    
  3. Verify browser is installed:

    • Check default browser setting in OS
    • Try setting BROWSER environment variable

Code Copy Doesn't Work

Symptom: Pressing c doesn't copy to clipboard

Solutions:

  1. Check clipboard support:

    vim
    :echo has('clipboard')
    " Should return 1
    
  2. Install clipboard provider:

    bash
    # macOS (already has pbcopy)
    
    # Linux
    sudo apt install xclip  # or xsel
    
  3. Manual copy:

    • Select code with mouse and copy
    • Retype the code in browser

Authentication State Management

Session Persistence

Once authenticated:

  • Session persists across Neovim restarts
  • No re-authentication needed every time
  • Token auto-refreshed in background
  • Stored securely by daemon

Re-authentication Required

You'll need to re-authenticate if:

  • Token expires (typically after 90 days)
  • Device access revoked in account settings
  • Daemon reset or reinstalled

Check Current Auth Status

vim
:LovelaceHealth

The authentication section shows your current status.

Security Considerations

Device Authorization Benefits

  • No passwords in editor: Credentials never touch Neovim
  • Revocable access: Devices can be revoked in account settings
  • Limited scope: Only grants access needed for task submission
  • Secure token storage: Tokens stored by daemon, not Neovim

Token Security

Where tokens are stored:

  • macOS: Keychain
  • Linux: libsecret or encrypted file
  • Windows: Windows Credential Manager

Token rotation: Tokens are automatically refreshed before expiration.

Revoking Device Access

To revoke this device's access:

  1. Visit https://uselovelace.com/settings/devices
  2. Find this device in the list
  3. Click "Revoke Access"
  4. Re-authenticate when needed with :LovelaceAuth

Integration with Workflows

First-Time Setup

vim
" 1. Run health check
:LovelaceHealth
" Shows "Not authenticated"

" 2. Authenticate
:LovelaceAuth
" Complete device flow

" 3. Verify authentication
:LovelaceHealth
" Shows user account info

Regular Usage

Authentication is automatic after initial setup. You only interact with :LovelaceAuth if:

  • Checking current authentication status
  • Troubleshooting auth issues
  • Re-authenticating after token expiration

Troubleshooting Workflow

vim
" Task submission fails
:LovelaceTask
" Error: Authentication required

" Check auth status
:LovelaceAuth
" Shows "Session expired"

" Re-authenticate
:LovelaceAuth
" Complete device flow again

" Retry task
:LovelaceTask
" Now succeeds

Related Commands

CommandPurpose
:LovelaceHealthVerify authentication status
:LovelaceSessionView session information
:LovelaceTaskSubmit task (requires auth)

Next Steps

Related Documentation