-
Notifications
You must be signed in to change notification settings - Fork 240
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
Support experimental_ignoreInterstitial
option and use it for api routes
#1429
Conversation
🦋 Changeset detectedLatest commit: 776c0a6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
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.
✅ Great news! Jit hasn't found any security issues in your PR. Good Job! 🏆
13530df
to
42f6f67
Compare
/** | ||
* @experimental | ||
*/ | ||
signInUrl?: string; | ||
isApiRoute?: boolean; |
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.
@dimkl I think that we should make this more generic and call it ignoreInterstitial
, which is either a boolean or a function boolean | ((url: URL | string) => string);
. That way, we can cover more use cases such as assets, etc...
The apiRoutes option we added in @clerk/nextjs should also be able to leverage it.
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 didn't add the function in type since the url
of the request is not available in the @clerk/backend
package.
We can do that after the addition of the request
parameter (see: #1393)
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.
Correct. @nikosdouvlis how far are we from merging #1393 ?
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.
@SokratisVidros, i think we can continue with the boolean
type and enhance it ( boolean | ((url: URL | string) => boolean);
) when request
parameter PR is merged.
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.
The authenticateRequest
PR should be merged today, but lets do what @dimkl suggested.
Dimitri, can we add a JSDOC comment documenting what the prop does?
I'm not a fan of the ignoreIInterstitial
name as it feels like an escape hatch and nothing a non-advanced Clerk user would understand. That being said, I don't have any better alternatives at the moment.
ignoreInterstitial
option and use it for api routes
5ab58bf
to
f6e3882
Compare
ac974b6
to
723bdbd
Compare
@SokratisVidros , @nikosdouvlis comments have been addressed. PTAL. |
ignoreInterstitial
option and use it for api routesexperimental_ignoreInterstitial
option and use it for api routes
06d9ad8
to
383c628
Compare
!snapshot |
Hey @dimkl - the snapshot version command generated the following package versions:
Tip: use the snippet copy button below to quickly install the required packages. # @clerk/backend
npm i @clerk/backend@0.24.0-snapshot.383c628 # @clerk/chrome-extension
npm i @clerk/chrome-extension@0.3.19-snapshot.383c628 # @clerk/clerk-js
npm i @clerk/clerk-js@4.51.0 # eslint-config-custom
npm i eslint-config-custom@0.3.0 # @clerk/clerk-expo
npm i @clerk/clerk-expo@0.18.10-snapshot.383c628 # @clerk/fastify
npm i @clerk/fastify@0.5.6-snapshot.383c628 # gatsby-plugin-clerk
npm i gatsby-plugin-clerk@4.3.19-snapshot.383c628 # @clerk/localizations
npm i @clerk/localizations@1.22.0 # @clerk/nextjs
npm i @clerk/nextjs@4.21.13-snapshot.383c628 # @clerk/clerk-react
npm i @clerk/clerk-react@4.21.1-snapshot.383c628 # @clerk/remix
npm i @clerk/remix@2.6.16-snapshot.383c628 # @clerk/clerk-sdk-node
npm i @clerk/clerk-sdk-node@4.11.0-snapshot.383c628 # @clerk/shared
npm i @clerk/shared@0.19.1 # @clerk/themes
npm i @clerk/themes@1.7.5 # @clerk/types
npm i @clerk/types@3.46.1 |
This option will convert interstitial and unknown request states to signed-out.
…able interstitial in api routes
383c628
to
776c0a6
Compare
/** | ||
* @experimental | ||
*/ | ||
experimental_isApiRoute?: BooleanOrURLFnToBoolean; |
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 experimental_ignoreInterstitial?
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 thought that frameworks using the @clerk/backend
would have the option to define their API routes (that's why I have set it as experimental_isApiRoute
) and that we could use it internally to whatever we want eg:
- ignore interstitial
- avoid redirecting to sign-in (case of NextJS)
Mainly I have used the same logic we have for NextJS and applied it to sdk-node.
Should I rename it toexperimental_ignoreInterstitial
or not?
cc: @nikosdouvlis
Closing in favor of the solutions we're discussing at https://www.notion.so/clerkdev/Interstitial-public-Api-Pages-10369bee0edf47f3b410e45f2723f12c |
Type of change
Packages affected
@clerk/clerk-js
@clerk/clerk-react
@clerk/nextjs
@clerk/remix
@clerk/types
@clerk/themes
@clerk/localizations
@clerk/clerk-expo
@clerk/backend
@clerk/clerk-sdk-node
@clerk/shared
@clerk/fastify
@clerk/chrome-extension
gatsby-plugin-clerk
build/tooling/chore
Description
npm test
runs as expected.npm run build
runs as expected.Handle interstitial as signed-out for API routes.
Example usages