joerdav / shopping-list

9 stars 0 forks source link

google auth setup #1

Closed gedw99 closed 1 month ago

gedw99 commented 3 months ago

Nice project. Its amazing how far you can get with just golang.

Could you let me and others know how you setup the google auth ?

Wish we had a standard email based auth too. Any reason why you chose Google auth ?

joerdav commented 3 months ago
  1. Create a new google cloud project
  2. Configure the consent screen https://console.cloud.google.com/apis/credentials/consent
  3. Create OAuth creds https://console.cloud.google.com/apis/credentials
  4. Make sure to allow the redirect urls needed, for me it was: "http://localhost:7331/auth/redirect" and "https://shoplist.fly.dev/auth/redirect"

Then grab the ID&Secret for use with your app.

gedw99 commented 2 months ago

Thanks @joerdav

I am using nats auth call-out , so I should be able to adapt it to work with Google auth.

https://docs.nats.io/running-a-nats-service/configuration/securing_nats/auth_callout

https://natsbyexample.com/examples/auth/callout/cli

https://m.youtube.com/watch?v=VvGxrT-jv64

the reason for nats is because you get global clustering . Leaf node is embedded into each server and the global nats keeps them all up to date.

https://docs.nats.io/running-a-nats-service/configuration/leafnodes

joerdav commented 1 month ago

Interesting! I need to take a look at this. I hope my answer helped though

gedw99 commented 1 month ago

thanks it helps.

I am not looking for golang code that can actually do this GUI dance that we need to do to setup access to Google cloud. It just too heavy for users, and even devs IMHO.

I saw some code a while back that did all this from a CLI and was reusable.

About NATS auth etc, just buzz me if you want.. Its amazing stuff but takes a while.