question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failure on setGenericPassword()

See original GitHub issue

Attempting to get setup with react-native-keychain but I am receiving the error below.

TypeError: Cannot read property 'setGenericPasswordForService' of undefined(…)

I’ve installed the npm library and linked it with rnpm. I checked my Libraries folder in XCode to confirm RNKeychain.xcodeproj was installed and I can see the library installed in the Linked Binaries as well.

import Keychain from 'react-native-keychain';

export default class Init extends Component {
  componentDidMount() {
        var username = 'zuck';
    var password = 'poniesRgr8';

    Keychain
        .setGenericPassword(username, password)
        .then(function() {
                console.log('Credentials saved successfully!');
          }).catch(function(error) {
            console.log('Could not set Generic Password. ', error);
          });
  }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:10
  • Comments:19

github_iconTop GitHub Comments

6reactions
EthanChouTWcommented, Feb 27, 2017

I’m getting this error on "react-native": "0.40.0","react-native-keychain": "^1.1.0" and fixes with import * as Keychain from 'react-native-keychain'; instead of import Keychain from 'react-native-keychain';

2reactions
Moumenecommented, Jan 24, 2017

Thanks for the response @akullpp I did this before but what i was doing wrong is the import. Import Keychain from ‘react-native-keychain’ instead of Import * as Keychain …

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native keychain error when using setGenericPassword ...
I resolved the problem by defining the STORAGE_TYPE let options: Keychain.Options = { storage:Keychain.STORAGE_TYPE.FB};.
Read more >
react-native-keychain - Bountysource
I am using react-native-keychain 6.2.0 and see this error when using ... i am running into an issue on Samsung devices when calling...
Read more >
How to use the react-native-keychain.getGenericPassword ...
To help you get started, we've selected a few react-native-keychain.getGenericPassword examples, based on popular ways it is used in public projects.
Read more >
react-native-keychain - npm
setGenericPassword (username, password); try { // Retreive the credentials const credentials = await Keychain.
Read more >
React Native Biometrics | by Zalmy Muskal - Medium
The format is setGenericPassword(username, password, [{ accessControl, ... After 5 failed attempts ... getsupportedBioemtryType() will return null }
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found