Fix handling PKCE flag in the example client

Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>
This commit is contained in:
Ayato 2025-03-13 22:31:36 +09:00 committed by GitHub
parent acfc8ad99b
commit c2842f3356
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,11 +34,15 @@ func main() {
port := os.Getenv("PORT")
scopes := strings.Split(os.Getenv("SCOPES"), " ")
responseMode := os.Getenv("RESPONSE_MODE")
pkce, err := strconv.ParseBool(os.Getenv("PKCE"))
if err != nil {
logrus.Fatalf("error parsing PKCE %s", err.Error())
}
var pkce bool
if pkceEnv, ok := os.LookupEnv("PKCE"); ok {
var err error
pkce, err = strconv.ParseBool(pkceEnv)
if err != nil {
logrus.Fatalf("error parsing PKCE %s", err.Error())
}
}
redirectURI := fmt.Sprintf("http://localhost:%v%v", port, callbackPath)
cookieHandler := httphelper.NewCookieHandler(key, key, httphelper.WithUnsecure())