outfrost / deckswipe

Single player card game skeleton based on Reigns and Lapse
MIT License
75 stars 29 forks source link

[GoogleSheetsImporter] Request failed #31

Closed PaulL98 closed 4 years ago

PaulL98 commented 5 years ago

Hi outfrost, There seems to be a problem when loading the google sheets which make the project not playable. Is there any way you could fix it ? thanks

outfrost commented 5 years ago

Hi, yeah, I deleted the API key that DeckSwipe used to pull its data from Google Sheets, so even though the sheet still exists (here), the current code of GoogleSheetsImporter can't access it. I deleted the key, because, with the way it was set up, it was impossible to secure it against potential abuse, and I could start getting billed for it if someone found the key ;)

I was going to replace the hardcoded key in the project with a better way to generate and supply your own key for testing (#30), but I haven't got around to it. If time permits, I will try to do that soon. In the meantime, to get the project running, you can create your own API key at console.cloud.google.com (once you create a project: APIs & Services -> Dashboard -> Enable APIs -> Google Sheets API; then APIs & Services -> Credentials -> Create credentials -> API key -> Restrict Key -> Sheets API), and copy-paste the key into the appropriate string constant in GoogleSheetsImporter. You can also replace the sheet ID with your own, if you create a similar spreadsheet.

Usually, an API key would be hidden on some sort of server and never visible to the public, so the lack of additional security wouldn't matter. Here, well, it's a dirty test setup ;)

PaulL98 commented 5 years ago

thank you for your help :)

outfrost commented 4 years ago

I have now improved the way the API key and spreadsheet ID are supplied.

The API key goes in <persistent data path>/secrets/google_sheets.json:

{
    "apiKey": "1234abcd"
}

The spreadsheet ID goes in <persistent data path>/google_sheets_config.json:

{
    "spreadsheetId": "1234abcd"
}

You still need to generate your own API key (and have it on each device running the project), but now it's more secure and the log messages tell you about it.