freeboard
    Preparing search index...

    Function useRejectFailedAuthentication

    • Answer every operation of a request whose bearer token failed authentication with that UNAUTHENTICATED error, before any resolver runs.

      This is a hook rather than a throw from setContext because a context-factory error is only reported cleanly by Yoga's own /graphql handler: the graphql-sse endpoint (/graphql/stream) turns it into an HTTP 500 with a plain-text stack trace. Stopping execution here gives both transports an ordinary GraphQL result (HTTP 200, errors[0].extensions.code). The result carries data: null because graphql-sse only recognises an object with a data key as a result; without it /graphql/stream answers HTTP 400.

      Returns Plugin