Update auth package to allow persisted queries - #9997
Draft
emmatown wants to merge 1 commit into
Draft
Conversation
emmatown
force-pushed
the
push-uuytqqtprsvm
branch
2 times, most recently
from
August 18, 2026 05:40
5397e9f to
0a0cdb2
Compare
emmatown
marked this pull request as draft
August 21, 2026 00:13
emmatown
force-pushed
the
push-uuytqqtprsvm
branch
from
August 24, 2026 02:18
0a0cdb2 to
8edcdb7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is to allow a Keystone setup where persisted queries are required for all callers except the Admin UI.
To make that approach work, the mutation that the Admin UI uses for authentication naturally needs to use a persisted query since it's not authenticated yet. This makes two small changes to
@keystone-6/authto make it possible to use it:createAuthreturns apersistedQueriesfunction that returns a map of a sha256 hash to the exact query the front-end uses so it can be used in where you definefetchcall for the sign in mutation that adds the appropriateextensions.persistedQuerywhile still passing the actual query in so this doesn'tfetchdirectly rather than getting Apollo Client to sendextensions.persistedQuerysince I don't think we want to this for any other query and it seemed like unnecessary complexityNote this doesn't use persisted queries for all Admin UI queries, I don't think this would be very practical or helpful since those queries are very dynamic so it would be a massive number of queries that essentially allows anything.
In a PR stacked on top of this, I've added an example that actually uses persisted queries in the way described above.