Skip to main content
Version: 9.1.0

Function: getGenericPassword()

getGenericPassword(serviceOrOptions?): Promise<false | UserCredentials>

Fetches the username and password combination for the given service.

Parameters

serviceOrOptions?: string | GetOptions

A keychain options object or a service name string.

Returns

Promise<false | UserCredentials>

Resolves to an object containing service, username, password, and storage when successful, or false on failure.

Example

const credentials = await Keychain.getGenericPassword();
if (credentials) {
console.log('Credentials successfully loaded for user ' + credentials.username);
} else {
console.log('No credentials stored');
}

Defined in

index.ts:73