A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pub.dev/documentation/github/latest/github/../github/findAuthenticationInMap.html below:

findAuthenticationInMap function - github library

findAuthenticationInMap function

Checks the passed in map for keys in COMMON_GITHUB_TOKEN_ENV_KEYS. The first one that exists is used as the github token to call Authentication.withToken with. If the above fails, the GITHUB_USERNAME and GITHUB_PASSWORD keys will be checked. If those keys both exist, then Authentication.basic will be used.

Implementation
Authentication? findAuthenticationInMap(Map map) {
  for (final key in COMMON_GITHUB_TOKEN_ENV_KEYS) {
    if (map.containsKey(key)) {
      return Authentication.withToken(map[key]);
    }
    if (map['GITHUB_USERNAME'] is String && map['GITHUB_PASSWORD'] is String) {
      return Authentication.basic(
          map['GITHUB_USERNAME'], map['GITHUB_PASSWORD']);
    }
  }
  return null;
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4