clerk / javascript

Official Javascript repository for Clerk authentication
https://clerk.com
MIT License
981 stars 221 forks source link

fix(astro,backend): Refactor `createRedirect` to support hash routing #3679

Closed panteliselef closed 1 week ago

panteliselef commented 2 weeks ago

Description

This PR updates the signature of createRedirect and allows for the following

createRedirect({
    redirectAdapter,
    baseUrl: clerkRequest.clerkUrl,
    signInUrl: requestState.signInUrl,
    signUpUrl: requestState.signUpUrl,
    publishableKey: getSafeEnv(context).pk!,
}).redirectToSignIn({ returnBackUrl: e.returnBackUrl, asHash: true });

asHash will construct a correctly formatted url that can be used with hash routing.

Without asHash

http://localhost:4011/sign-in?redirect_url=http%3A%2F%2Flocalhost%3A4011%2Fuser

With asHash:true

http://localhost:4011/sign-in#/?redirect_url=http%3A%2F%2Flocalhost%3A4011%2Fuser

Checklist

Type of change

changeset-bot[bot] commented 2 weeks ago

🦋 Changeset detected

Latest commit: d5a0ddc67ab6fa8d9f1c30c376948edb7dbd6842

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

This PR includes changesets to release 9 packages | Name | Type | | --------------------- | ----- | | @clerk/backend | Patch | | @clerk/astro | Patch | | @clerk/express | Patch | | @clerk/fastify | Patch | | @clerk/nextjs | Patch | | @clerk/remix | Patch | | @clerk/clerk-sdk-node | Patch | | @clerk/tanstack-start | Patch | | @clerk/testing | Patch |

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

panteliselef commented 2 weeks ago

!snapshot

clerk-cookie commented 2 weeks ago
Hey @panteliselef - the snapshot version command generated the following package versions: Package Version
@clerk/astro 0.0.2-snapshot.vbc9b8d7
gatsby-plugin-clerk 5.0.0-beta.45
@clerk/testing 1.1.10-snapshot.vbc9b8d7

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

npm i @clerk/astro@0.0.2-snapshot.vbc9b8d7 --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact

@clerk/testing

npm i @clerk/testing@1.1.10-snapshot.vbc9b8d7 --save-exact
panteliselef commented 2 weeks ago

!snapshot

clerk-cookie commented 2 weeks ago
Hey @panteliselef - the snapshot version command generated the following package versions: Package Version
@clerk/astro 0.0.2-snapshot.vbbff478
@clerk/backend 1.3.1-snapshot.vbbff478
@clerk/express 0.0.16-snapshot.vbbff478
@clerk/fastify 1.0.18-snapshot.vbbff478
gatsby-plugin-clerk 5.0.0-beta.45
@clerk/nextjs 5.2.3-snapshot.vbbff478
@clerk/remix 4.2.2-snapshot.vbbff478
@clerk/clerk-sdk-node 5.0.15-snapshot.vbbff478
@clerk/tanstack-start 0.1.6-snapshot.vbbff478
@clerk/testing 1.1.10-snapshot.vbbff478

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

npm i @clerk/astro@0.0.2-snapshot.vbbff478 --save-exact

@clerk/backend

npm i @clerk/backend@1.3.1-snapshot.vbbff478 --save-exact

@clerk/express

npm i @clerk/express@0.0.16-snapshot.vbbff478 --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.18-snapshot.vbbff478 --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.2.3-snapshot.vbbff478 --save-exact

@clerk/remix

npm i @clerk/remix@4.2.2-snapshot.vbbff478 --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.15-snapshot.vbbff478 --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.1.6-snapshot.vbbff478 --save-exact

@clerk/testing

npm i @clerk/testing@1.1.10-snapshot.vbbff478 --save-exact
panteliselef commented 1 week ago

We will not be needing this for @clerk/astro at the moment, as we will have advice devs to use path routing.