-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(clerk-js): Simplify dev browser handling #2345
Conversation
🦋 Changeset detectedLatest commit: 0917fed The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types 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 |
f8bde01
to
94021cd
Compare
94021cd
to
a954168
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to apply this changes to AP as well, correct?
export const DEV_BROWSER_SSO_JWT_PARAMETER = '__clerk_db_jwt'; | ||
export const DEV_BROWSER_JWT_MARKER = '__clerk_db_jwt'; | ||
export const DEV_BROWSER_SSO_JWT_KEY = 'clerk-db-jwt'; | ||
export const DEV_BROWSER_JWT_KEY = '__clerk_db_jwt'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally!
@@ -2,7 +2,7 @@ import { apiUrlFromPublishableKey } from '@clerk/shared/apiUrlFromPublishableKey | |||
import { isTruthy } from '@clerk/shared/underscore'; | |||
|
|||
export const CLERK_JS_VERSION = process.env.NEXT_PUBLIC_CLERK_JS_VERSION || ''; | |||
export const CLERK_JS_URL = process.env.NEXT_PUBLIC_CLERK_JS || ''; | |||
export const CLERK_JS_URL = process.env.NEXT_PUBLIC_CLERK_JS_URL || ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change as the current variable is called NEXT_PUBLIC_CLERK_JS
@dimkl we need to include this in the changelog/ upgrade guide
@@ -73,7 +73,7 @@ export const createFontSizeScale = (theme: Theme): Record<keyof typeof fontSizes | |||
return { | |||
xs: (numericValue * 0.6875).toString() + unit, | |||
sm: (numericValue * 0.75).toString() + unit, | |||
md: (numericValue * 0.8125).toString() + unit, | |||
md: (numericValue * 1).toString() + unit, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be reverted
c16d653
to
3e66133
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
}); | ||
|
||
fapiClient.onAfterResponse((_, response) => { | ||
const newDevBrowserJWT = response?.headers?.get('Clerk-Db-Jwt'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) Can we make this a constant that lives with the others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
setDevBrowserCookie(existingDevBrowserCookie); | ||
} | ||
|
||
// 2. Get the JWT from hash or search parameters when the redirection comes from AP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hedging considering we're going to drop the hash transport mechanism:
// 2. Get the JWT from hash or search parameters when the redirection comes from AP | |
// 2. Get the JWT from the URL when the redirection comes from AP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I have a to-do item for this, but I'd like us to see how V4 and V5 will work in AP before the final change. So we will get back to this next week.
export const removeSessionCookie = () => sessionCookie.remove(); | ||
|
||
export const setSessionCookie = (token: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this new pattern 👍
fapiClient: FapiClient; | ||
}; | ||
|
||
export function createDevBrowser({ frontendApi, fapiClient }: CreateDevBrowserOptions): DevBrowser { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ why not make this a class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan of classes 😆
1. Work only with URL based session syncing dev instances and drop support for cookie-based syncing dev instances. 2. Align nomenclature across cookie, hearer and search param names 3. Drop cookie handler in favor of dedicated cookie handlers, one for each cookie (__clerk_db_jwt, __session, __client_uat)
3e66133
to
0917fed
Compare
Description
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
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