async getAuthInfo()

in services/shared/apps/tenant-management/src/tenants/tenants.service.ts [52:83]


  async getAuthInfo(referer: string) {
    try {
      //grab the path of the referer header
      console.log('Referer:', referer);
      const path = this.getPath(referer);
      console.log('Path:', path);
      console.log('Tablename:', this.authTableName);
      const client = this.clientFac.client;
      const cmd = new GetCommand({
        Key: {
          tenant_path: path,
        },
        TableName: this.authTableName,
      });
      const item = await client.send(cmd);
      return {
        aws_project_region: this.region,
        aws_cognito_region: this.region,
        aws_user_pools_id: item.Item.user_pool_id,
        aws_user_pools_web_client_id: item.Item.client_id,
      };
    } catch (error) {
      console.error(error);
      throw new HttpException(
        {
          status: HttpStatus.INTERNAL_SERVER_ERROR,
          error: error,
        },
        HttpStatus.INTERNAL_SERVER_ERROR,
      );
    }
  }