diff --git a/packages/gatsby-source-drupal/src/gatsby-node.js b/packages/gatsby-source-drupal/src/gatsby-node.js index 7ca564a6b3659..5901e7cb96622 100644 --- a/packages/gatsby-source-drupal/src/gatsby-node.js +++ b/packages/gatsby-source-drupal/src/gatsby-node.js @@ -194,12 +194,21 @@ exports.sourceNodes = async ( } // Resolve w/ baseUrl if node.uri isn't absolute. const url = new URL(fileUrl, baseUrl) + // If we have basicAuth credentials, add them to the request. + const auth = + typeof basicAuth === `object` + ? { + htaccess_user: basicAuth.username, + htaccess_pass: basicAuth.password, + } + : {} fileNode = await createRemoteFileNode({ url: url.href, store, cache, createNode, createNodeId, + auth, }) } catch (e) { // Ignore