Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .changeset/shiny-glasses-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
'@clerk/chrome-extension': major
'@clerk/clerk-js': minor
'@clerk/shared': minor
---

Expand the ability for `@clerk/chrome-extension` WebSSO to sync with host applications which use URL-based session syncing.

### How to Update

**WebSSO Local Host Permissions:**

Add the following to the top-level `content_scripts` array key in your `manifest.json` file:
```json
{
"matches": ["*://localhost/*"], // URL of your host application
"js": ["src/content.tsx"] // Path to your content script
}
```

**Content Script:**

In order to sync with your host application, you must add the following to your content script to the path specified in the `manifest.json` file above:

```ts
import { ContentScript } from '@clerk/chrome-extension';

ContentScript.init(process.env.CLERK_PUBLISHABLE_KEY || "");
```
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"mode": "auto"
}
],
"json.schemas": [
{
"fileMatch": ["manifest.json"],
"url": "https://json.schemastore.org/chrome-manifest.json"
}
],
"cSpell.words": [
"accountsstage",
"adduser",
Expand Down
121 changes: 74 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"http-server": "^14.1.1",
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-chrome": "^0.8.0",
"jest-environment-jsdom": "^29.3.1",
"lint-staged": "^14.0.1",
"npm-cli-adduser": "^1.1.4",
Expand All @@ -101,5 +102,8 @@
"engines": {
"node": ">=18.17.0",
"npm": ">=8.5.0"
},
"overrides": {
"jest": "$jest"
}
}
5 changes: 3 additions & 2 deletions packages/chrome-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ WebSSO usage snippet:
// ...
<ClerkProvider
publishableKey={publishableKey}
navigate={to => navigate(to)}
routerPush={to => navigate(to)}
routerReplace={to => navigate(to, { replace: true })}
syncSessionWithTab
>
{/* ... */}
</ClerkProvider>
//...
// ...
```

Examples of a chrome extension using the `@clerk/chrome-extension` package for authentication
Expand Down
Loading