Use external resource in Word add-in with non-hard coded bearer token or is it possible to use an environment variable during runtime?

mv 0 Reputation points
2023-07-05T15:08:27.1933333+00:00

Using a Word add-in, I'd like to make an external resource the subject of a fetch call, then inserted into the task pane. I've gotten it to work but only if I hardcode the environment variable in the fetch request header. A fairly recent question in Stack Overflow suggests that using environment variables during an add-in runtime isn't feasible. The question is how would I go about accessing the external resource which requires a bearer token that isn't hard-coded? Relatedly, can't seem to get process.env.<ENV_VAR> to work within taskpane.js

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,019 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.