Skip to content

feat(chrome-extension): WebSSO with URL-based session syncing [SDK-836] - #2277

Merged
SokratisVidros merged 9 commits into
mainfrom
chrome-ext-web-sso
Dec 13, 2023
Merged

feat(chrome-extension): WebSSO with URL-based session syncing [SDK-836]#2277
SokratisVidros merged 9 commits into
mainfrom
chrome-ext-web-sso

Conversation

@tmilewski

@tmilewskitmilewski commented Dec 6, 2023

Copy link
Copy Markdown
Member

Description

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

How to Update

WebSSO Local Development Host Permissions:

Add *://localhost:*/* to the host_permissions array in your manifest.json file:

{
"host_permissions": ["*://localhost:*/*"]
}

If you're using a local domain other than localhost, you'll want replace that entry with your domain: *://<DOMAIN>/*

{
"host_permissions": ["*://<DOMAIN>/*"]
}

WebSSO Provider settings:

<ClerkProviderpublishableKey={publishableKey}routerPush={to=>navigate(to)}routerReplace={to=>navigate(to,{replace: true})}syncSessionWithTab// tokenCache is now storageCache (See below)storageCache={/* ... */}// [Development Only]: If the host application isn't on // `http://localhost`, you can provide it here:syncSessionHost="http://<DOMAIN>">

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:

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

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/backend
  • @clerk/chrome-extension
  • @clerk/clerk-js
  • @clerk/clerk-expo
  • @clerk/fastify
  • gatsby-plugin-clerk
  • @clerk/localizations
  • @clerk/nextjs
  • @clerk/clerk-react
  • @clerk/remix
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/themes
  • @clerk/types
  • build/tooling/chore

@tmilewskitmilewski self-assigned this Dec 6, 2023
@changeset-bot

changeset-botBot commented Dec 6, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 75c8d36

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@clerk/chrome-extensionMajor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment threadpackage.json
Comment threadpackages/chrome-extension/src/ClerkProvider.tsx Outdated
Comment threadpackages/chrome-extension/src/ClerkProvider.tsx Outdated
Comment threadpackages/chrome-extension/src/errors.ts Outdated
Comment threadpackages/chrome-extension/src/utils/validation.ts Outdated
Comment threadpackages/chrome-extension/tsconfig.lint.json
Comment threadpackages/chrome-extension/src/utils/validation.test.ts Outdated
Comment threadpackages/chrome-extension/src/utils/validation.test.ts Outdated
Comment threadpackages/chrome-extension/src/utils/storage.ts
Comment threadpackages/chrome-extension/src/ClerkProvider.tsx
Comment threadpackages/chrome-extension/src/index.ts Outdated

@dimkldimkl left a comment

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.

@SokratisVidros Could you also take a look?

@tmilewski

Copy link
Copy Markdown
MemberAuthor

!snapshot

@clerk-cookie

Copy link
Copy Markdown
Collaborator

Hey @tmilewski - the snapshot version command generated the following package versions:

PackageVersion
@clerk/backend1.0.1-snapshot.vb99c163
@clerk/chrome-extension1.0.1-snapshot.vb99c163
@clerk/clerk-js5.0.1-snapshot.vb99c163
@clerk/clerk-expo1.0.1-snapshot.vb99c163
@clerk/fastify1.0.1-snapshot.vb99c163
gatsby-plugin-clerk5.0.1-snapshot.vb99c163
@clerk/localizations2.0.1-snapshot.vb99c163
@clerk/nextjs5.0.1-snapshot.vb99c163
@clerk/clerk-react5.0.1-snapshot.vb99c163
@clerk/remix4.0.1-snapshot.vb99c163
@clerk/clerk-sdk-node5.0.1-snapshot.vb99c163
@clerk/shared2.0.1-snapshot.vb99c163
@clerk/themes2.0.1-snapshot.vb99c163
@clerk/types4.0.1-snapshot.vb99c163

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/backend

npm i @clerk/backend@1.0.1-snapshot.vb99c163 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.0.1-snapshot.vb99c163 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.0.1-snapshot.vb99c163 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@1.0.1-snapshot.vb99c163 --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.1-snapshot.vb99c163 --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.1-snapshot.vb99c163 --save-exact

@clerk/localizations

npm i @clerk/localizations@2.0.1-snapshot.vb99c163 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.0.1-snapshot.vb99c163 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.0.1-snapshot.vb99c163 --save-exact

@clerk/remix

npm i @clerk/remix@4.0.1-snapshot.vb99c163 --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.1-snapshot.vb99c163 --save-exact

@clerk/shared

npm i @clerk/shared@2.0.1-snapshot.vb99c163 --save-exact

@clerk/themes

npm i @clerk/themes@2.0.1-snapshot.vb99c163 --save-exact

@clerk/types

npm i @clerk/types@4.0.1-snapshot.vb99c163 --save-exact

@tmilewski
tmilewski added this pull request to the merge queue Dec 13, 2023
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Dec 13, 2023
@SokratisVidros
SokratisVidros merged commit b6b19b5 into mainDec 13, 2023
@SokratisVidros
SokratisVidros deleted the chrome-ext-web-sso branch December 13, 2023 16:11
@pavelbinar

Copy link
Copy Markdown

Hi guys 👋🏻
Can you please add storageCache to the @clerk/clerk-react as well?
I am writing an desktop app running a react app in the web-view which does not support cookies, but does the local storage.

I would like to use the ClerkProvider in @clerk/clerk-react with storageCache option.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@tmilewski@clerk-cookie@pavelbinar@SokratisVidros@dimkl