async getCredentials()

in src/providers/profile.ts [19:41]


  async getCredentials(): Promise<Credentials> {
    if (!this.innerProvider) {
      let sharedCfgPath = process.env.ALIBABA_CLOUD_CREDENTIALS_FILE;
      if (!sharedCfgPath) {
        if (!this.homedir) {
          throw new Error('cannot found home dir');
        }
        sharedCfgPath = path.join(this.homedir, '.alibabacloud/credentials');
      }

      const ini = await loadIni(sharedCfgPath);
      this.innerProvider = this.getCredentialsProvider(ini);
    }

    const credentials = await this.innerProvider.getCredentials();

    return Credentials.builder()
      .withAccessKeyId(credentials.accessKeyId)
      .withAccessKeySecret(credentials.accessKeySecret)
      .withSecurityToken(credentials.securityToken)
      .withProviderName(`${this.getProviderName()}/${this.innerProvider.getProviderName()}`)
      .build();
  }