added oauth flow to get authorization code

This commit is contained in:
2026-01-22 19:52:43 +11:00
parent 7be15160d5
commit c14c5d43ee
15 changed files with 1313 additions and 32 deletions

23
pkg/oauth/config.go Normal file
View File

@@ -0,0 +1,23 @@
package oauth
import (
"git.haelnorr.com/h/golib/env"
"github.com/pkg/errors"
)
type Config struct {
PrivateKey string // ENV OAUTH_PRIVATE_KEY: Private key for signing OAuth state tokens (required)
}
func ConfigFromEnv() (any, error) {
cfg := &Config{
PrivateKey: env.String("OAUTH_PRIVATE_KEY", ""),
}
// Check required fields
if cfg.PrivateKey == "" {
return nil, errors.New("Envar not set: OAUTH_PRIVATE_KEY")
}
return cfg, nil
}