Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

API for user information

A topic by Isaac Ashdown created Dec 07, 2016 Views: 1,971 Replies: 8
Viewing posts 1 to 2
(+1)

Hello,

Is there any API available to query the information about the user playing my game? Such as their itch.io username (for display in a scoreboard, for example)?

I'm guessing the answer is no, as I can't find any documentation to that effect. So this is probably a feature request :D

(2 edits) (+1)

Hey Isaac,

The proper endpoint is https://itch.io/api/1/:api-key/me - you can try it in a browser where you're logged into itch.io: https://itch.io/api/1/me/me

Hi Amos, thanks for the reply. Can you point me to the relevant documentation for this feature?

I guess I'm still a little confused. Do I need to get an api-key first? Which means then having the user authorise my game to access their itch account? That's probably too high of a barrier of entry for our game, unfortunately.

Hey Isaac, the API key & scoping section of the itch docs walk you through the whole process.

In a nutshell:

  • You ask for API access by adding a line to a simple text file in your game
  • An expiring key (tied to your game and the player) gets passed as an environment variable to your game
  • You can send it to your servers, and do the `/me` request from there!
I really recommend reading:

Awesome, thanks Amos!

Perhaps this method would also be a way of getting information about a game that's private, such as the latest version?

(1 edit)

See "Looking for updates" here https://itch.io/docs/butler/pushing.html - but this won't work for protected/private games for now - it's on our TODO list!

Hi again Amos,

So I got this working a few days ago but it's stopped, appears to have been when the itch client updated. I have the manifest file in the game's root folder, but no key is passed to the app. The log appears to be generating a key fine:

[2016-12-16 @ 13:38:21.065] [tasks/launch] Requesting subkey with scope: profile:me
[2016-12-16 @ 13:38:21.248] [tasks/launch] Got subkey (171 chars, expires 2016-12-23 12:38:19)
[2016-12-16 @ 13:38:21.255] [tasks/launch/native] env keys: [
"ITCHIO_API_KEY",
"ITCHIO_API_KEY_EXPIRES_AT",
"TMP",
"TEMP"
]

I also renamed my project at this time, to something that includes Spaces. After doing that I noticed that the itch app wasn't finding my manifest, so I reinstalled the game in the app. Note that this is on windows.

I'm not sure if this is an issue with itch or on my end, but the way I'm getting the env variable was working before. Any ideas?

Thanks,

Isaac

Thanks, I'm able to reproduce the issue and will issue a fix shortly.

I'm puzzled by the app not finding the manifest file on a path with spaces though - that shouldn't happen. Can you tell me exact reproduction steps?

v22.1.0 has been released, which fixes the problem - thanks for reporting!

(1 edit)

Sorry Amos, I should've been clearer - after reinstalling the game, it found the manifest fine. Beforehand it didn't. My suspicion is that renaming was the cause of the error, but I haven't verified that. It would mean the repro would hypothetically be:

  1. Create a game with a manifest
  2. Install the game, note it finds the manifest fine
  3. Rename the game
  4. Publish an update to the game
  5. Update the game in the itch app
  6. Launch the game - it doesn't find the manifest
  7. Uninstall and reinstall the game - it finds the manifest

This is basically more or less what I did, I think. But there were other factors involved probably, such as updating the itch app itself somewhere in the middle there.

Deleted 7 years ago