1.1.8 • Published 2 years ago

@agilesoft/type_ags_authrest2 v1.1.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

@agilesoft/js_ags_authrest2

Login npm agilesoft username&password in onepassword

Installation

Use the package manager NPM to install foobar.

npm i @agilesoft/type_ags_authrest2

Usage

import ags_restauth from "@agilesoft/type_ags_authrest2";

var ENV_DEPLOY = ENVIRONMENT || "dev";
if (ENV_DEPLOY === "production") {
  var Auth = new ags_restauth(R_TOKEN, R_USER, R_PASS, R_PATH);
}

# Exlample 'Middleware'
    var data;
    if (ENV_DEPLOY === "production") {
      // production-specific code
      console.log("production");
      data = await Auth.Middleware(request);
    } else {
      // staging-specific code
      console.log("staging");
      try {
        data = await request.json();
      } catch (error) {
        data = await request.text();
      }
    }

# Exlample 'Encrept Headers,BodyData'
var request = require('request')
(async () => {
  var options = {
    method: 'POST',
    url: 'http://127.0.0.1:8787/encrypt',
    headers: {
      Authorization: await Auth.genTokenEncryp(),
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      encrypData: await Auth.encrypbody({ data: 'test' }),
    }),
  }
  request(options, function(error, response) {
    if (error) throw new Error(error)
    console.log(response.body)
  })
})()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT# -agilesoft-type_ags_authrest2

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago