How to use the react-native-keychain.hasInternetCredentials function in react-native-keychain

To help you get started, we’ve selected a few react-native-keychain examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oblador / react-native-keychain / test_index.js View on Github external
getSupportedBiometryType().then(result => {
  (result: ?string);
});

// $FlowExpectedError - First 3 arguments are required
setInternetCredentials();
setInternetCredentials('server', 'username', 'password');
setInternetCredentials('server', 'username', 'password', simpleOptions).then(
  result => {
    (result: void);
  }
);

// $FlowExpectedError - First argument is required
hasInternetCredentials();
hasInternetCredentials('server').then(result => {
  (result: boolean);
});

// $FlowExpectedError - First argument is required
getInternetCredentials();
getInternetCredentials('server', simpleOptions).then(credentials => {
  if (credentials) {
    (credentials.username: string);
    (credentials.password: string);
  }
});

// $FlowExpectedError - First argument is required
resetInternetCredentials();
resetInternetCredentials('server', simpleOptions).then(result => {
  (result: void);
github developmentseed / observe / app / services / auth.js View on Github external
export async function isAuthorized () {
  // TODO cache this with a TTL, since it's called on every state change
  return Keychain.hasInternetCredentials(Config.API_URL)
}
github developmentseed / observe / app / services / auth.js View on Github external
export async function getAdditionalHeaders (url) {
  const headers = {}

  if (
    Config.PREAUTH_URL != null &&
    url.startsWith(Config.API_URL) &&
    (await Keychain.hasInternetCredentials(Config.PREAUTH_URL))
  ) {
    const { username, password } = await Keychain.getInternetCredentials(
      Config.PREAUTH_URL
    )

    headers.Cookie = `${username}=${password}`
  }

  return headers
}