Skip to content

Commit

Permalink
Merge pull request #95 from getAlby/task-cookies
Browse files Browse the repository at this point in the history
fix: set domain for cookies
  • Loading branch information
kiwiidb authored Jun 22, 2023
2 parents 490833d + 2a1bd98 commit d2018e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions alby.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ func (svc *AlbyOAuthService) CallbackHandler(c echo.Context) error {
svc.db.Save(&user)

sess, _ := session.Get("alby_nostr_wallet_connect", c)
if svc.cfg.CookieDomain != "" {
sess.Options.Domain = svc.cfg.CookieDomain
}
sess.Values["user_id"] = user.ID
sess.Save(c.Request(), c.Response())
return c.Redirect(302, "/")
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const (
type Config struct {
NostrSecretKey string `envconfig:"NOSTR_PRIVKEY"`
CookieSecret string `envconfig:"COOKIE_SECRET" required:"true"`
CookieDomain string `envconfig:"COOKIE_DOMAIN"`
ClientPubkey string `envconfig:"CLIENT_NOSTR_PUBKEY"`
Relay string `envconfig:"RELAY" default:"wss://relay.getalby.com/v1"`
LNBackendType string `envconfig:"LN_BACKEND_TYPE" default:"ALBY"`
Expand Down
1 change: 1 addition & 0 deletions lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"encoding/hex"

"github.com/sirupsen/logrus"
"gorm.io/gorm"

Expand Down

0 comments on commit d2018e7

Please sign in to comment.