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

Move OAuth Setup to a manual process #98

Merged
merged 2 commits into from
Mar 5, 2023
Merged

Conversation

markmandel
Copy link
Contributor

@markmandel markmandel commented Mar 3, 2023

Move OAuth Setup to a manual process

Moving the manual setup to a manual process, and setup initial callback URL using sslip.io.

In the process also included:

  • Improved error logging for failure to login.
  • Updated README.md instructions.
  • Set fixed size on launcher window, also center on screen
    (mainly because I use a tiling window manager)
  • Use a static IP for the frontend service so we can template out
    config variables.

Work on #86

resource "local_file" "services-frontend-config-map" {
content = templatefile(
"${path.module}/files/services/frontend-configmap.yaml.tpl", {
client_id = google_iap_client.project_client.client_id
client_secret = google_iap_client.project_client.secret
client_id = var.frontend-service.client_id
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried looking up the secret using data google_iap_client, but got permission errors. I gave up at that point and just said "write the values here" 😄

README.md Outdated Show resolved Hide resolved
@markmandel markmandel force-pushed the feature/manual-brand.oauth branch 3 times, most recently from 0c19ee9 to 1dfa7ef Compare March 4, 2023 01:32
Let's grab the IP for that API, by running:

```shell
gcloud compute addresses list --filter=name=frontend-service --format="value(address)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we use a static IP, we don't have to wait until we've deployed the Kubernetes resources, which is nice.


This should give you back an IP, such as `35.202.107.204`.

1. Click "+ ADD URI" under "Authorised JavaScript origins" and add "http://[IP_ADDRESS].sslip.io".
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sslip.io FTW!

@@ -137,6 +167,25 @@ Open the [`game`](./game) folder in Unreal Engine. Once finished opening, you ca
the editor (Hit the ▶️ button), or we can package the project via: Platforms > {your host platform} > Package Project,
and execute the resultant package.

## Run the Game Launcher
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder section for now. Not for this PR, but I feel like we should take the same approach as terraform.tfvars.sample where we copy it, but I'm happy to care of that instructions and @kennycoder you can tell me what you think 😄

For packaging check here:
https://developer.fyne.io/started/packaging
```shell
go run main.go
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found myself just doing this a lot, so it felt better having it up top.

Also I think long term, this is what we should tell people to do, and edit the app.ini to where they put their Game Build (for later anyway).

@@ -63,7 +63,9 @@ func main() {
// UI
myApp = app.New()
myWindow = myApp.NewWindow("Google for Games Launcher")
myWindow.SetFixedSize(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more messing up the layout with your resizing!

myWindow.Resize(fyne.NewSize(320, 260))
myWindow.CenterOnScreen()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now my tiling window manager doesn't try and resize it into tiling mode 😃

I also think it's nice for the little launcher to show up in the middle anyway.

@markmandel
Copy link
Contributor Author

Okay! This looks like login is now working! The sslip.io hack is working quite nicely.

What I ran into was the fact the profile service doesn't have a schema (@dtest), so that's where it fails at the moment (which is known, just giving everyone a heads up).

Profile service:

could not abort: spanner: code = "InvalidArgument", desc = "Table not found: players [at 1:8]\\nINSERT players (player_google_id, player_name, profile_image, region, skill_l...\\n       ^"[GIN] 2023/03/04 - 01:14:52 | 400 |   65.384238ms |   10.36.128.224 | POST     "/players"

The one weird thing is that the frontend service reports this as (@kennycoder fyi):

Launcher:

Unable to fetch user information. Expired token?: {"context":"profile lookup","error":"profile not found: 103062280621782723934"}

Which I guess IS accurate, since with no place to store data, there definitely is no players 😄

Anyway - if anyone wants to merge this that is fine, but also happy to get review (especially on all the instructions).

Enjoy your weekend everyone!

@bbhuston
Copy link
Collaborator

bbhuston commented Mar 5, 2023

@markmandel

Checked out this PR and ran it against a fresh GCP project. I give it a caveated LGTM.

Here were the results when running terraform apply:

Good news: The brand error no longer occurs. Great work!

Issue 1: Hit TF syntax error in tfvars.sample file
Fix: I just pushed up a commit that fixes this. Please pull that down to your local branch.

╷
│ Error: Invalid character
│ 
│   on terraform.tfvars line 122:
│  122:   client_secret = 'CLIENT_SECRET'
│ 
│ Single quotes are not valid. Use double quotes (") to enclose strings.
╵
╷
│ Error: Invalid expression
│ 
│   on terraform.tfvars line 122:
│  122:   client_secret = 'CLIENT_SECRET'
│ 
│ Expected the start of an expression, but found an invalid expression token.
╵

Others Issues: Hit the compute API and registory API not ready issue (as expected)
Fix: This is expected behavior at this point. We'll solve this later with when we resolve #107

markmandel and others added 2 commits March 5, 2023 11:19
Moving the manual setup to a manual process, and setup initial callback
URL using sslip.io.

In the process also included:

* Improved error logging for failure to login.
* Updated README.md instructions.
* Set fixed size on launcher window, also center on screen
  (mainly because I use a tiling window manager)
* Use a static IP for the frontend service so we can template out
  config variables.

Work on #86
@markmandel markmandel force-pushed the feature/manual-brand.oauth branch from 6f9d3eb to 7a0705c Compare March 5, 2023 19:19
@markmandel markmandel merged commit d5ceaa8 into main Mar 5, 2023
@markmandel markmandel deleted the feature/manual-brand.oauth branch March 5, 2023 19:21
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

Successfully merging this pull request may close these issues.

4 participants