mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-03-17 17:34:02 +00:00
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>
This commit is contained in:
committed by
GitHub
parent
065c1f2cd5
commit
9c7df6412c
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user