Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

No ITCHIO_API_KEY environment variable

A topic by AlterHowdegen created Oct 18, 2021 Views: 658 Replies: 7
Viewing posts 1 to 2

I'm not getting the itch api key (and expiration) environment variables, tested on two Windows machines running app version 25.5.1 with manifest file :

[[actions]]
name = "play"
path = "xxx.exe"
scope = "profile:me"

Am I missing something or is this a current bug?

Admin(+1)

If you open up the app’s logs you should see what environment variables are being sent to your executable, which could help you narrow down where the issue is happening.

App logs say: Environment variables passed: TMP, TEMP, ITCHIO_API_KEY, ITCHIO_API_KEY_EXPIRES_AT
But neither a

SET

 in cmd nor a 

Environment.GetEnvironmentVariable("ITCHIO_API_KEY") 

in C# show anything. Had a couple of testers confirm, same behavior for everybody. The app log also say the TMP and TEMP env vars should be changed, but they are not.

Admin (2 edits) (+1)

Testers who have their own games, or other people who tested your game? If your game is not working on your computer then it’s not likely to work elsewhere. The only thing I can think of off the top of my head is that if your executable entry point spawns a subprocess it’s possible that the subprocess will not have access to the environment variables from the parent process.

Testers with my game, yes. Just wanted to make sure it's not an issue with my machine.
Are the environment variables supposed to be exclusive to the process and thus not visible through, say, the Windows command prompt? In that case I have been approaching the whole process in the wrong way (treated the evnironment variables as a global thing).

Admin(+1)

Environment variables are inhered by sub processes. Although there may be global environment variables, if a program launches a sub program with an environment, you will not be able to read those variables in an unrelated program’s environment.

thank you so much for the clarification.

I’ve got smooth “login with itch” functionality going on the game now, very happy!

I got it to work. Thanks for the help and sorry for the confusion!

If anybody stumbles upon this with the same issue: The environment variables set by the itch app are not supposed to show up outside of the process.