Keychain.FindPassword

From Xojo Documentation

Method

Keychain.FindPassword(ByRef kci as KeychainItem) As String

Supported for all project types and targets.

Attempts to find the password for an Item in the given Keychain that matches kci. At the end of a successful call, kci will point to the found Keychain Item. If it fails, it generates a KeychainException.

Example

The following example retrieves the password and displays it in a message box.

Var itemToFind As KeychainItem
Var password As String

itemToFind = New KeychainItem
// Indicate the name of the application whose keychain item you wish to find
itemToFind.ServiceName = "MyApplication"

// get application's password from the system keychain
password = System.Keychain.FindPassword(itemToFind)
MessageBox("The password for this item is: " + password)

Exception err As KeychainException
MessageBox("Can't find item: " + err.Message)