diff --git a/alby.go b/alby.go index 8eda5b20..ae816a2d 100644 --- a/alby.go +++ b/alby.go @@ -407,6 +407,7 @@ func (svc *AlbyOAuthService) SendPaymentSync(ctx context.Context, senderPubkey, } func (svc *AlbyOAuthService) AuthHandler(c echo.Context) error { + appName := c.QueryParam("c") // c - for client // clear current session sess, _ := session.Get(CookieName, c) if sess.Values["user_id"] != nil { @@ -419,7 +420,7 @@ func (svc *AlbyOAuthService) AuthHandler(c echo.Context) error { sess.Save(c.Request(), c.Response()) } - url := svc.oauthConf.AuthCodeURL("") + url := svc.oauthConf.AuthCodeURL(appName) // pass on the appName as state return c.Redirect(302, url) } diff --git a/echo_handlers.go b/echo_handlers.go index 30e5eb66..9f6bf540 100644 --- a/echo_handlers.go +++ b/echo_handlers.go @@ -273,7 +273,7 @@ func (svc *Service) AppsNewHandler(c echo.Context) error { sess.Options.Domain = svc.cfg.CookieDomain } sess.Save(c.Request(), c.Response()) - return c.Redirect(302, fmt.Sprintf("/%s/auth", strings.ToLower(svc.cfg.LNBackendType))) + return c.Redirect(302, fmt.Sprintf("/%s/auth?c=%s", strings.ToLower(svc.cfg.LNBackendType), appName)) } //construction to return a map with all possible permissions