Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud saves #213

Open
jeremyckahn opened this issue Sep 15, 2021 · 7 comments
Open

Cloud saves #213

jeremyckahn opened this issue Sep 15, 2021 · 7 comments
Assignees

Comments

@jeremyckahn
Copy link
Owner

jeremyckahn commented Sep 15, 2021

Add Google Drive-based authentication and support for cloud-based game saves.

Users should be able to log into the game and save their files automatically to the cloud.

@jeremyckahn
Copy link
Owner Author

jeremyckahn commented Oct 4, 2021

For reference: https://developers.google.com/drive/api

@jeremyckahn
Copy link
Owner Author

jeremyckahn commented Nov 29, 2022

We should be able to use https://github.com/anthonyjgrove/react-google-login for this.

Never mind, the Google APIs that react-google-login depend on are deprecated: anthonyjgrove/react-google-login#538

@jeremyckahn jeremyckahn self-assigned this Nov 29, 2022
@jeremyckahn jeremyckahn changed the title Add Google Drive syncing for game saves Cloud saves Jan 15, 2023
@jeremyckahn
Copy link
Owner Author

Using Google for cloud saves wound up being problematic. Their latest "one tap" login solution requires a 5-second delay before logging in upon revisiting the page. This would make for a poor UX. For now, I'm going to explore using Discord as the identity provider and storing the save files in a managed MongoDB database.

It looks like logging in via Discord should be achievable:

@jeremyckahn
Copy link
Owner Author

It seems that the Discord strategy requires a backend for authentication. 😕 We don't have that aside from some serverless functions in Vercel right now, and I don't know if that's worth bringing in just for this.

I think I might set this task down for now and come back to it later. If anyone else wants to implement cloud save functionality, let me know!

@jeremyckahn
Copy link
Owner Author

jeremyckahn commented Jan 16, 2023

We might also consider not using a third-party service for identity management. We could do it completely client-side and streamline the authentication process with the Credential Management API. I'm thinking that we could request a username and password from the user, hash the two strings together in the browser, and use that hashed result as the unique identifier for the user in the backend.

@jeremyckahn
Copy link
Owner Author

It occurred to me that the design described in my previous comment is prone to abuse. There's nothing stopping users from crafting API requests that would fill up any database we manage with junk data. I want to keep project infrastructure management to a minimum for Farmhand, so this may not be a path forward. Considering that, we may want to go back to using a third-party identity provider. Google has proven to be problematic, so perhaps we could consider Dropbox or GitHub accounts because such accounts could be used to store users' game data as well.

@jeremyckahn
Copy link
Owner Author

Rather than leveraging a specific cloud storage/identity provider to implement a cloud save system, I'd like to look towards using WebAuthn to identify users. We can use player's WebAuthn-based ID to tie them to their stored save data on the back end. This should hopefully prevent abuse and empower players to manage their Farmhand identity however they'd like to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant