From 819c0bc13c99f3f6e4f39348c7d7fbf2a8d746dd Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:08:19 +0530 Subject: [PATCH] [cli] Fix login for auth app when passkey is enabled --- cli/pkg/account.go | 2 +- cli/pkg/sign_in.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/pkg/account.go b/cli/pkg/account.go index 0e94689e5f9..03077eb7921 100644 --- a/cli/pkg/account.go +++ b/cli/pkg/account.go @@ -60,7 +60,7 @@ func (c *ClICtrl) AddAccount(cxt context.Context) { } if authResponse.IsPasskeyRequired() { - authResponse, flowErr = c.verifyPassKey(cxt, authResponse) + authResponse, flowErr = c.verifyPassKey(cxt, authResponse, app) } if authResponse.EncryptedToken == "" || authResponse.KeyAttributes == nil { log.Fatalf("missing key attributes or token.\nNote: Please use the mobile,web or desktop app to create a new account.\nIf you are trying to login to an existing account, report a bug.") diff --git a/cli/pkg/sign_in.go b/cli/pkg/sign_in.go index b931a7fe254..4218c5b60ba 100644 --- a/cli/pkg/sign_in.go +++ b/cli/pkg/sign_in.go @@ -141,12 +141,12 @@ func (c *ClICtrl) validateTOTP(ctx context.Context, authResp *api.AuthorizationR } } -func (c *ClICtrl) verifyPassKey(ctx context.Context, authResp *api.AuthorizationResponse) (*api.AuthorizationResponse, error) { +func (c *ClICtrl) verifyPassKey(ctx context.Context, authResp *api.AuthorizationResponse, app api.App) (*api.AuthorizationResponse, error) { if !authResp.IsPasskeyRequired() { return authResp, nil } baseAccountUrl := viper.GetString("endpoint.accounts") - passkeyAuthUrl := fmt.Sprintf("%s/passkeys/verify?passkeySessionID=%s&redirect=ente-cli://passkey&clientPackage=io.ente.photos", baseAccountUrl, authResp.PassKeySessionID) + passkeyAuthUrl := fmt.Sprintf("%s/passkeys/verify?passkeySessionID=%s&redirect=ente-cli://passkey&clientPackage=%s", baseAccountUrl, authResp.PassKeySessionID, app.ClientPkg()) fmt.Printf("Open this url in browser to verify passkey: %s\n", passkeyAuthUrl) err := browser.OpenURL(passkeyAuthUrl) if err != nil {