Auth patch to @directus/gatsby-source-directus (#7119)

Gatsby needs one-time access to the images at build time with the secure access token. With this security patch it is now no longer needed to have all Directus files continuously exposed to the public.

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
Matteljay
2021-08-02 16:03:39 +02:00
committed by GitHub
parent fb0559c7c3
commit fbcd50444c

View File

@@ -169,7 +169,7 @@ exports.sourceNodes = async (gatsby, options) => {
exports.createResolvers = async ({ actions, cache, createNodeId, createResolvers, store, reporter }, options) => {
const { createNode } = actions;
const { url } = options;
const { url, auth } = options;
let endpoints = normalizeEndpoint(url);
@@ -187,6 +187,7 @@ exports.createResolvers = async ({ actions, cache, createNodeId, createResolvers
cache,
createNode,
createNodeId,
httpHeaders: { Authorization: `Bearer ${auth.token}` },
reporter,
});
},