Hi Team
I am building an app for Jira using Forge where i am invoking Atlassian Org API to get the Users Last Activity Date.
however I have to pass the Org API token as a auth header to access the API. I want to create a confige page with a field in Manage apps section to store the Org API token.
I wanted to know if this is possible in the first place. If yes how can i achieve this.
your help is much appreciated.
Thanks & Regards
Bhaskar.
@Bhaskar To enable end-users to manage their credentials within the app, you should store the Org API token as a secret using Forge Storage. Refer to the documentation below for guidance:
Forge Secret Store
If you prefer to store a secret as a constant across all instances of your app, follow the suggestion by @AaronCollier .
thank you @kashsingh , i figured it out and was able to use Storage to store the API key.
however i was wondering how to use the variables like @AaronCollier said. I don’t see any example which articulates how to use variables in the code.
You use it with something like this:
process.env.VARIABLE_NAME
So maybe:
headers: {
'Authorization': `Bearer ${process.env.ORG_API_TOKEN}`
}
1 Like
thank you @AaronCollier, will try.
if i am not wrong to set the variables we just need to type forge variables set in the cli
and directly consume the variable like you mentioned…
i tried it before but there was no luck when i was tunneling. I was bit confused with the documentation
export FORGE_USER_VAR_MY_KEY=test
Thanks for the help.