Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
In this PR, I add user account management. It includes a backend script that runs the server handling client requests, as well as a setup script to create the database. I also added a client library that the game can use to fulfill user account requests. The user account management system uses OAuth to authenticate users. It supports persistent login sessions with access and refresh tokens. Account information (e.g. username) can be queried and updated from the client.
Changes Made
We use OAuth for our login. When the user requests to login, the client creates a webserver and opens a webpage to Google OAuth. After the user logs in, the access credentials are send to the client webserver. The client then forwards these credentials to the backend server, which exchanges them for account information. The backend server then creates its own credentials using JWT and gives them to the client. This forms the login session. The client can now makes requests authorized by its JWTs. Refresh tokens are used to limit the lifetime of access tokens.
Relevant user information includes:
Account/client
OAuthManager
class.test.py
offers a command line interface for testing the library.Account/server
backend.py
handles account requests.env
andconfig.yml
configuration.py
hosts configuration boilerplate.env
contains sensitive credentials (should not be exposed)setup_db.py
sets up the Postgres server for the backendTest Coverage
Tested by running an instance of the server and running
test.py
to verify expected behavior.Next Steps