Skip to main content

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

How to read user_id or email on client?

A topic by Socke81 created Apr 18, 2021 Views: 785 Replies: 2
Viewing posts 1 to 3

Hi, I am planning to release a game on itch.io this year. Since it is a multiplayer game I just looked at the API. I would have to check on my server if a user owns the game. For this I can use the server API and the URL https://itch.io/api/1/KEY/game/GAME_ID/purchases . As parameter I can use email or user_id. user_id would be ideal but how do I get the user_id in my game so that I can forward it to my server? Or does the user have to enter it himself? That would be very uncomfortable.

(+1)

If user runs your game using the itch app, it sets the environment variable ITCHIO_API_KEY which can be used with server-side API, provided that you added .itch.toml manifest file with proper scope attribute - the link also includes an example of using /api/1/jwt/me endpoint for getting the user info.

If user does not use itch app, it becomes more complicated. The game can use itch OAuth for authentication, but that would require redirecting user to browser (or using some sort of embedded browser).

That's a very interesting way itch does it. Looks very simple. Thanks for the detailed answer.

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.