0.0.4 • Published 1 year ago

@gdi/node-logger v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Auto-login

A staging script that runs through the login process and returns an axios instance ready for API calls.

Installation

yarn add @gli/auto-login

Note: you need access to gli's private NPM

Usage

Replace EMAIL and PASSWORD with valid staging credentials:

const { createAxiosInstance, logger } = require('@gli/auto-login');

const main = async () => {
    const axiosInstance = await createAxiosInstance({
        email: 'EMAIL',
        password: 'PASSWORD',
        logger,
    });

    const user = await axiosInstance.get('/current_user');
    console.log('user ->', user.data);
};

main();

Motivation

The auto-login script can be the base for:

  • E2E data seeder: create datasets for e2e Cypress tests
  • Tests: simplify manual tests by advancing approval flows, creating requests, etc
  • Devtools: CLIs and Chrome extensions that need access to staging
  • Facades: build server facades for dev usages