Skip to content

Commit

Permalink
feat(chrome-extension): WebSSO with URL-based session syncing [SDK-83…
Browse files Browse the repository at this point in the history
…6] (#2277)

* feat(chrome-extension): Extend WebSSO in Chrome Extension [SDK-836]

* chore(chrome-extension): Full CI rebuild

* chore(chrome-extension): Add internal deps

* fix(chrome-extension): Remove prepublishOnly command

* fix(repo): Explicitly account for subpaths

* chore(chrome-extension): Update dependencies

* feat(chrome-extension): Remove requirement for `syncSessionHost`

* chore(repo): Force update

---------

Co-authored-by: Sokratis Vidros <[email protected]>
  • Loading branch information
tmilewski and SokratisVidros authored Dec 13, 2023
1 parent ab4eb56 commit b6b19b5
Show file tree
Hide file tree
Showing 24 changed files with 1,061 additions and 998 deletions.
65 changes: 65 additions & 0 deletions .changeset/shiny-glasses-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
'@clerk/chrome-extension': major
---

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

### How to Update

**WebSSO Host Permissions:**

_Local Development: You must have your explicit development domain added to your `manifest.json` file in order to use the WebSSO flow._

Example:

```json
{
"host_permissions": [
// ...
"http://localhost"
// ...
]
}
```

_Production: You must have your explicit Clerk Frontend API domain added to your `manifest.json` file in order to use the WebSSO flow._

Example:
```json
{
"host_permissions": [
// ...
"https://clerk.example.com"
// ...
]
}
```

**WebSSO Provider settings:**

```tsx
<ClerkProvider
publishableKey={publishableKey}
routerPush={to => navigate(to)}
routerReplace={to => navigate(to, { replace: true })}
syncSessionWithTab

// tokenCache is now storageCache (See below)
storageCache={/* ... */}
>
```

**WebSSO Storage Cache Interface:**

With the prop change from `tokenCache` to `storageCache`, the interface has been expanded to allow for more flexibility.

The new interface is as follows:

```ts
type StorageCache = {
createKey: (...keys: string[]) => string;
get: <T = any>(key: string) => Promise<T>;
remove: (key: string) => Promise<void>;
set: (key: string, value: string) => Promise<void>;
};
```
Loading

0 comments on commit b6b19b5

Please sign in to comment.