Using "op" CLI to get MFA Code Value

Hi, is there away to get the current MFA value from "op" command line tool?

For example I want to get a value by running the following
op get item My_AWS_Creds | jq '.details.fields[] | select(.name=="mfacode").value'

This will be very useful especially now that the AWS CLI supports MFA session tokens.

1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided


  • Actually nevermind, I digged deep in the "get" subcommands and found the answer, I had to run
    $ op get totp My_AWS_Creds

  • ag_anaag_ana

    Team Member

    Thank you for the update @HiThere! It's great to hear that you managed to find this already.

    If you have any other questions, please feel free to reach out anytime.

    Have a wonderful day :)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file