fix(auth): use appropriate settings

Signed-off-by: Sphericalkat <me@kat.bio>
This commit is contained in:
Amogh Lele 2024-06-16 18:21:11 +05:30
parent edd528960d
commit 925faf7011
Signed by: sphericalkat
GPG Key ID: 1C022B9CED2425B4
3 changed files with 5 additions and 3 deletions

View File

@ -21,7 +21,7 @@ func main() {
DisableStartupMessage: true,
})
url := oauthConf.WhoopLoginConfig.AuthCodeURL("state", oauth2.AccessTypeOffline)
url := oauthConf.WhoopLoginConfig.AuthCodeURL("a5080d6b05b3", oauth2.AccessTypeOffline)
fmt.Println("Visit the URL for the auth dialog: ", url)
app.Get("/oauth2/callback", func(c *fiber.Ctx) error {
@ -32,6 +32,7 @@ func main() {
token, err := oauthConf.WhoopLoginConfig.Exchange(c.Context(), code)
if err != nil {
slog.Error("error exchanging code for token", "err", err)
return c.SendStatus(fiber.StatusInternalServerError)
}
@ -39,5 +40,5 @@ func main() {
return c.JSON(token)
})
app.Listen(":8000")
app.Listen(":8080")
}

View File

@ -13,7 +13,7 @@ import (
type Config struct {
WhoopClientID string `koanf:"WHOOP_CLIENT_ID"`
WhoopClientSecret string `koanf:"WHOO_CLIENT_SECRET"`
WhoopClientSecret string `koanf:"WHOOP_CLIENT_SECRET"`
WhoopAuthURL string `koanf:"WHOOP_AUTH_URL"`
WhoopTokenURL string `koanf:"WHOOP_TOKEN_URL"`
}

View File

@ -18,6 +18,7 @@ func ProvideWhoopConfig(conf *Config) (*OauthConfig, error) {
Endpoint: oauth2.Endpoint{
AuthURL: conf.WhoopAuthURL,
TokenURL: conf.WhoopTokenURL,
AuthStyle: oauth2.AuthStyleInParams,
},
Scopes: []string{
"offline",