If access for assistive devices has been enabled, you can use UI scripting to click the allow buttons:
security find-generic-password -l AppleID -w & sleep 1; osascript -e 'tell app "System Events" to click button 2 of group 1 of window 1 of process "SecurityAgent"'
security find-generic-password -l AppleID -w & sleep 1; osascript -e 'tell app "System Events" to click button 2 of group 1 of window 1 of process "SecurityAgent"'
You could also use something like https://github.com/smerrill/os-x-click even if access for assistive devices wasn't enabled.