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 auth checking helpers #707

Merged
merged 3 commits into from
Feb 27, 2024
Merged

Fix auth checking helpers #707

merged 3 commits into from
Feb 27, 2024

Conversation

JohnAlbin
Copy link
Contributor

@JohnAlbin JohnAlbin commented Feb 26, 2024

This pull request is for:

  • packages/next-drupal

GitHub Issue: #667

Describe your changes

The isBasicAuth, isAccessTokenAuth, and isClientIdSecretAuth are all mis-implemented. This PR fixes the implementations and uses of those helper functions.

The PR also abstracts the creation of the Authorization header with a new getAuthorizationHeader method and removes the TODO: Abstract this to a re-usable that Shad had added. Before this method was added the Buffer.from(`${username}:${password}`).toString("base64") code pattern was in DrupalClient 3 different times.

Lastly, I noticed that the withAuth option to DrupalClient.fetch() was being passed down to the init param of the global fetch() when it is not one of the allowed init properties. So I've updated the code to consume the withAuth option in DrupalClient.fetch() and prevent it from being passed down to the underlying fetcher.

The `withAuth` option belongs to the DrupalClient.fetch() method but was
mistakenly being passed to the init param of the global fetch and custom fetcher
functions.
Copy link

vercel bot commented Feb 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
next-drupal ⬜️ Ignored (Inspect) Feb 26, 2024 0:06am

@JohnAlbin JohnAlbin merged commit 510ac07 into main Feb 27, 2024
13 checks passed
@JohnAlbin JohnAlbin deleted the 667-fix-auth-checking-helpers branch February 27, 2024 07:27
@JohnAlbin JohnAlbin mentioned this pull request Mar 8, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants