Skip to content
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

fix(backend): Make all 4 keys (legacy and new) optional in authenticateRequest #1437

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

anagstef
Copy link
Member

@anagstef anagstef commented Jun 29, 2023

Type of change

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

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.

Make all 4 keys (legacy and new) optional in authenticateRequest. That will make the @clerk/backend easier to use.

@changeset-bot
Copy link

changeset-bot bot commented Jun 29, 2023

🦋 Changeset detected

Latest commit: 8db061c

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

This PR includes changesets to release 6 packages
Name Type
@clerk/clerk-sdk-node Patch
@clerk/backend Patch
gatsby-plugin-clerk Patch
@clerk/nextjs Patch
@clerk/fastify Patch
@clerk/remix 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

Copy link

@jit-ci jit-ci bot left a 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! 🏆

@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

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

Package Version
@clerk/backend 0.23.7-snapshot.ff9370c
@clerk/chrome-extension 0.3.19-snapshot.ff9370c
@clerk/clerk-js 4.51.0
eslint-config-custom 0.3.0
@clerk/clerk-expo 0.18.10-snapshot.ff9370c
@clerk/fastify 0.5.6-snapshot.ff9370c
gatsby-plugin-clerk 4.3.19-snapshot.ff9370c
@clerk/localizations 1.22.0
@clerk/nextjs 4.21.13-snapshot.ff9370c
@clerk/clerk-react 4.21.1-snapshot.ff9370c
@clerk/remix 2.6.16-snapshot.ff9370c
@clerk/clerk-sdk-node 4.10.14-snapshot.ff9370c
@clerk/shared 0.19.1
@clerk/themes 1.7.5
@clerk/types 3.46.1

Tip: use the snippet copy button below to quickly install the required packages.

# @clerk/backend
npm i @clerk/backend@0.23.7-snapshot.ff9370c
# @clerk/chrome-extension
npm i @clerk/chrome-extension@0.3.19-snapshot.ff9370c
# @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.ff9370c
# @clerk/fastify
npm i @clerk/fastify@0.5.6-snapshot.ff9370c
# gatsby-plugin-clerk
npm i gatsby-plugin-clerk@4.3.19-snapshot.ff9370c
# @clerk/localizations
npm i @clerk/localizations@1.22.0
# @clerk/nextjs
npm i @clerk/nextjs@4.21.13-snapshot.ff9370c
# @clerk/clerk-react
npm i @clerk/clerk-react@4.21.1-snapshot.ff9370c
# @clerk/remix
npm i @clerk/remix@2.6.16-snapshot.ff9370c
# @clerk/clerk-sdk-node
npm i @clerk/clerk-sdk-node@4.10.14-snapshot.ff9370c
# @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

packages/backend/src/tokens/authObjects.ts Outdated Show resolved Hide resolved
packages/sdk-node/src/utils.ts Outdated Show resolved Hide resolved
@anagstef anagstef force-pushed the fix_authenticate_request_params_type branch from ff9370c to a252412 Compare June 29, 2023 18:30
@anagstef anagstef changed the title refactor(backend): Refactor authenticateRequest params to not accept all 4 keys fix(backend): Make all 4 keys (legacy and new) optional in authenticateRequest Jun 29, 2023
@anagstef anagstef marked this pull request as ready for review June 29, 2023 18:32
@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

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

Package Version
@clerk/backend 0.23.7-snapshot.a252412
@clerk/chrome-extension 0.3.19-snapshot.a252412
@clerk/clerk-js 4.51.0
eslint-config-custom 0.3.0
@clerk/clerk-expo 0.18.10-snapshot.a252412
@clerk/fastify 0.5.6-snapshot.a252412
gatsby-plugin-clerk 4.3.19-snapshot.a252412
@clerk/localizations 1.22.0
@clerk/nextjs 4.21.13-snapshot.a252412
@clerk/clerk-react 4.21.1-snapshot.a252412
@clerk/remix 2.6.16-snapshot.a252412
@clerk/clerk-sdk-node 4.10.14-snapshot.a252412
@clerk/shared 0.19.1
@clerk/themes 1.7.5
@clerk/types 3.46.1

Tip: use the snippet copy button below to quickly install the required packages.

# @clerk/backend
npm i @clerk/backend@0.23.7-snapshot.a252412
# @clerk/chrome-extension
npm i @clerk/chrome-extension@0.3.19-snapshot.a252412
# @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.a252412
# @clerk/fastify
npm i @clerk/fastify@0.5.6-snapshot.a252412
# gatsby-plugin-clerk
npm i gatsby-plugin-clerk@4.3.19-snapshot.a252412
# @clerk/localizations
npm i @clerk/localizations@1.22.0
# @clerk/nextjs
npm i @clerk/nextjs@4.21.13-snapshot.a252412
# @clerk/clerk-react
npm i @clerk/clerk-react@4.21.1-snapshot.a252412
# @clerk/remix
npm i @clerk/remix@2.6.16-snapshot.a252412
# @clerk/clerk-sdk-node
npm i @clerk/clerk-sdk-node@4.10.14-snapshot.a252412
# @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

@@ -189,7 +189,7 @@ async function verifyRequestState(options: AuthenticateRequestOptions, token: st
export const isSatelliteAndNeedsSyncing: InterstitialRule = options => {
const { clientUat, isSatellite, searchParams, secretKey, apiKey, userAgent } = options;

const key = secretKey || apiKey;
const key = (secretKey || apiKey) as string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't wrong to assume this will work ? How about this instead ?

Suggested change
const key = (secretKey || apiKey) as string;
const key = secretKey || apiKey || '';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed all the occurrences!

@anagstef anagstef force-pushed the fix_authenticate_request_params_type branch from a252412 to 8db061c Compare June 29, 2023 20:50
@nikosdouvlis nikosdouvlis merged commit ac4e472 into main Jun 29, 2023
@nikosdouvlis nikosdouvlis deleted the fix_authenticate_request_params_type branch June 29, 2023 21:19
@clerk-cookie clerk-cookie mentioned this pull request Jun 29, 2023
@clerk-cookie
Copy link
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants