Save Password to Keychain
Saves a password into the keychain (for this account and/or yourID).
Save Password to Keychain [ Select ; Result (error) ; Password ; Account ; YourID ; Overwrite existing ]
|Select entire contents||replaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field|
|Result (error)||an error code|
|Password||the password to save|
|Account||the name of the account (or user) associated with this password|
|YourID||(optional) an extra ID for this password, store for example the solution name here|
|Overwrite existing||overwrite an existing password (with the same Account and YourID)|
Data type returned
The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:
|0||no error||the password was saved in the keychain|
|$$-25299||errKCDuplicateItem||the password already exists (for this account and yourID combination)|
Troi Encryptor Plug-in 4.0
FileMaker Pro 16 to 19
The password is safely stored in the keychain and it can be later retrieved from the keychain without the user needing to enter the (keychain) password. The keychain is unlocked when the user logs in to the operating system.
Be careful when using Overwrite Existing, after overwriting the previous password can no longer be retrieved.
Save Password to Keychain [ Select ; $Result ; "secret" ; "John Deere" ]
This will save the password for the user “John Deere” into the keychain.
Save Password to Keychain [ Select ; $ErrorCode ; "secret234G" ; "Sales" ; "Invoices|Notes|REC1001" ]
This will store the password “secret234G” into the keychain for the account “Sales”. The yourID parameter adds extra info which helps you distinguish between different passwords for the same account. Here the name of the database, the field Notes and even the recordID is stored. This shows the possibility of a very fine grained approach of giving access to a field on a per record basis.
You can later retrieve the password with this exact combination of account and yourID .
Note that this may be a too detailed approach, you can of course also save a password on a per database level (or even on a solution level). In this case the yourID parameter might be “Invoices” (or “MySolution”).
Used in example file
Related script steps
|Delete Password from Keychain|
|Get Password from Keychain|