diff --git a/gatsby-node.js b/gatsby-node.js index 0292ced..eff7b6b 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -283,9 +283,11 @@ class Plugin { Object.assign(headers, (await this.options.headers()) || {}); } - if (this.directus.auth.token) { + const token = await this.directus.auth.token; + + if (token) { Object.assign(headers, { - Authorization: `Bearer ${this.directus.auth.token}`, + Authorization: `Bearer ${token}`, }); } diff --git a/package.json b/package.json index ed129eb..67eaf96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@directus/gatsby-source-directus", - "version": "9.14.6", + "version": "9.14.7", "description": "Source plugin for pulling data into Gatsby from a Directus API.", "author": "João Biondo ", "license": "MIT",