Browse Source

Fix apikey login (#6922)

The API Key login needs some extra JSON return key's, same as password login.
Fixes #6912

Signed-off-by: BlackDex <black.dex@gmail.com>
main
Mathijs van Veluw 24 hours ago
committed by GitHub
parent
commit
9c7df6412c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      src/api/identity.rs

14
src/api/identity.rs

@ -633,6 +633,19 @@ async fn _user_api_key_login(
Value::Null Value::Null
}; };
let account_keys = if user.private_key.is_some() {
json!({
"publicKeyEncryptionKeyPair": {
"wrappedPrivateKey": user.private_key,
"publicKey": user.public_key,
"Object": "publicKeyEncryptionKeyPair"
},
"Object": "privateKeys"
})
} else {
Value::Null
};
// Note: No refresh_token is returned. The CLI just repeats the // Note: No refresh_token is returned. The CLI just repeats the
// client_credentials login flow when the existing token expires. // client_credentials login flow when the existing token expires.
let result = json!({ let result = json!({
@ -649,6 +662,7 @@ async fn _user_api_key_login(
"ResetMasterPassword": false, // TODO: according to official server seems something like: user.password_hash.is_empty(), but would need testing "ResetMasterPassword": false, // TODO: according to official server seems something like: user.password_hash.is_empty(), but would need testing
"ForcePasswordReset": false, "ForcePasswordReset": false,
"scope": AuthMethod::UserApiKey.scope(), "scope": AuthMethod::UserApiKey.scope(),
"AccountKeys": account_keys,
"UserDecryptionOptions": { "UserDecryptionOptions": {
"HasMasterPassword": has_master_password, "HasMasterPassword": has_master_password,
"MasterPasswordUnlock": master_password_unlock, "MasterPasswordUnlock": master_password_unlock,

Loading…
Cancel
Save