Pyautogui not entering all characters when using typewrite function
With AppleScript I made this for use in Automator:

https://gist.github.com/SuperHofstad/f826985ec536ff2d650699cb37a7fadc

set appPass to "PASSWORD" as text

tell application "System Events"
    delay 0.5
    repeat until exists process "SecurityAgent"
        delay 0.5
    end repeat
    tell process "SecurityAgent"
        keystroke appPass
        key code 36
    end tell
end tell