fix(auth): use appropriate settings
Signed-off-by: Sphericalkat <me@kat.bio>
This commit is contained in:
parent
edd528960d
commit
925faf7011
5
main.go
5
main.go
@ -21,7 +21,7 @@ func main() {
|
|||||||
DisableStartupMessage: true,
|
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)
|
fmt.Println("Visit the URL for the auth dialog: ", url)
|
||||||
|
|
||||||
app.Get("/oauth2/callback", func(c *fiber.Ctx) error {
|
app.Get("/oauth2/callback", func(c *fiber.Ctx) error {
|
||||||
@ -32,6 +32,7 @@ func main() {
|
|||||||
|
|
||||||
token, err := oauthConf.WhoopLoginConfig.Exchange(c.Context(), code)
|
token, err := oauthConf.WhoopLoginConfig.Exchange(c.Context(), code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
slog.Error("error exchanging code for token", "err", err)
|
||||||
return c.SendStatus(fiber.StatusInternalServerError)
|
return c.SendStatus(fiber.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,5 +40,5 @@ func main() {
|
|||||||
return c.JSON(token)
|
return c.JSON(token)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.Listen(":8000")
|
app.Listen(":8080")
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
WhoopClientID string `koanf:"WHOOP_CLIENT_ID"`
|
WhoopClientID string `koanf:"WHOOP_CLIENT_ID"`
|
||||||
WhoopClientSecret string `koanf:"WHOO_CLIENT_SECRET"`
|
WhoopClientSecret string `koanf:"WHOOP_CLIENT_SECRET"`
|
||||||
WhoopAuthURL string `koanf:"WHOOP_AUTH_URL"`
|
WhoopAuthURL string `koanf:"WHOOP_AUTH_URL"`
|
||||||
WhoopTokenURL string `koanf:"WHOOP_TOKEN_URL"`
|
WhoopTokenURL string `koanf:"WHOOP_TOKEN_URL"`
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ func ProvideWhoopConfig(conf *Config) (*OauthConfig, error) {
|
|||||||
Endpoint: oauth2.Endpoint{
|
Endpoint: oauth2.Endpoint{
|
||||||
AuthURL: conf.WhoopAuthURL,
|
AuthURL: conf.WhoopAuthURL,
|
||||||
TokenURL: conf.WhoopTokenURL,
|
TokenURL: conf.WhoopTokenURL,
|
||||||
|
AuthStyle: oauth2.AuthStyleInParams,
|
||||||
},
|
},
|
||||||
Scopes: []string{
|
Scopes: []string{
|
||||||
"offline",
|
"offline",
|
||||||
|
Loading…
Reference in New Issue
Block a user