Skip to content

feat(self-hosting): allow configuring CAP_CHROME_EXTENSION_ID for extension login#1992

Open
jerryno6 wants to merge 2 commits into
CapSoftware:mainfrom
jerryno6:feat/self-hosting-chrome-extension-auth
Open

feat(self-hosting): allow configuring CAP_CHROME_EXTENSION_ID for extension login#1992
jerryno6 wants to merge 2 commits into
CapSoftware:mainfrom
jerryno6:feat/self-hosting-chrome-extension-auth

Conversation

@jerryno6

@jerryno6 jerryno6 commented Jul 9, 2026

Copy link
Copy Markdown

Problem

When deploying Cap on a self-hosted instance, attempting to log in via the Chrome extension results in a 400 Bad Request / authentication failure. This is because the Next.js backend checks the incoming redirectUri against the allowed Chrome Web Store extension ID (via the CAP_CHROME_EXTENSION_ID environment variable). Since this variable is not mapped to the container in the default Docker Compose configurations and is undocumented, extension logins fail on all self-hosted deployments.

Solution

  1. Added the CAP_CHROME_EXTENSION_ID environment variable mapping to docker-compose.yml and docker-compose.coolify.yml under the cap-web service.
  2. Added the optional parameter to docker-compose.coolify.env.example.
  3. Documented the configuration parameter in README.md under the Self-Hosting environment list.

Fixes #1993

Comment thread README.md Outdated
Comment thread README.md Outdated
```bash
CAP_URL=https://cap.yourdomain.com
S3_PUBLIC_URL=https://s3.yourdomain.com
CAP_CHROME_EXTENSION_ID=fefjaffcodfiogbbngmjkcjpbpclbdcp # Chrome Web Store extension ID allowed to receive auth keys

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 security Published Extension ID Misleads Self-Hosts

When an operator builds or loads their own extension, Chrome uses that extension's assigned ID in chrome.identity.getRedirectURL(), not the published Cap Web Store ID shown here. Following this snippet with a self-built extension makes the backend compare against the wrong ID and reject extension login with 400.

Suggested change
CAP_CHROME_EXTENSION_ID=fefjaffcodfiogbbngmjkcjpbpclbdcp # Chrome Web Store extension ID allowed to receive auth keys
CAP_CHROME_EXTENSION_ID=your-chrome-extension-id # Extension ID allowed to receive auth keys (e.g. fefjaffcodfiogbbngmjkcjpbpclbdcp for the published Chrome Web Store extension)

Context Used: CLAUDE.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 109

Comment:
**Published Extension ID Misleads Self-Hosts**

When an operator builds or loads their own extension, Chrome uses that extension's assigned ID in `chrome.identity.getRedirectURL()`, not the published Cap Web Store ID shown here. Following this snippet with a self-built extension makes the backend compare against the wrong ID and reject extension login with 400.

```suggestion
CAP_CHROME_EXTENSION_ID=your-chrome-extension-id # Extension ID allowed to receive auth keys (e.g. fefjaffcodfiogbbngmjkcjpbpclbdcp for the published Chrome Web Store extension)
```

**Context Used:** CLAUDE.md ([source](https://app.greptile.com/cap/github/capsoftware/cap/-/custom-context?memory=9a906542-f1fe-42c1-89a2-9f252d96d9f0))

How can I resolve this? If you propose a fix, please make it concise.

Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com>
Comment thread README.md
Comment on lines +110 to 111
CAP_CHROME_EXTENSION_ID=fefjaffcodfiogbbngmjkcjpbpclbdcp
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding the published Web Store ID here might confuse self-hosters who build/load the extension themselves (their extension ID will differ). Might be clearer to show a placeholder and mention the published ID in a comment.

Suggested change
CAP_CHROME_EXTENSION_ID=fefjaffcodfiogbbngmjkcjpbpclbdcp
```
# Chrome extension ID allowed to receive auth keys
# Published Chrome Web Store extension: fefjaffcodfiogbbngmjkcjpbpclbdcp
CAP_CHROME_EXTENSION_ID=your-chrome-extension-id

@jerryno6 jerryno6 Jul 9, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THis is the official chrome extension of CAP, we should keep it as it is. Just mention it in the comment is enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(self-hosting): Chrome extension login fails on self-hosted instances (missing CAP_CHROME_EXTENSION_ID)

2 participants