Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[cli] Fix login for auth app when passkey is enabled

Neeraj Gupta819c0bc13c99
diff --git a/cli/pkg/account.go b/cli/pkg/account.go
index 0e94689e5f..03077eb792 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 b931a7fe25..4218c5b60b 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 {