token-verify-att 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +27 -0
  2. package/index.js +1 -2
  3. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Package de manejo de token
2
+
3
+ realiza transacciones del token, especificamente valida en cache si ya existe un token valido y vigente y lo devuelve, en caso de que no va al servicio de crracion de token y solicita uno nuevo
4
+
5
+ ## Instalación 🚀
6
+
7
+ Instrucciones paso a paso para poner el proyecto en marcha. [2, 7, 15]
8
+ ```bash
9
+ # instalar la dependencia token-verify-att
10
+ npm install token-verify-att
11
+
12
+ # Instalar la dependencia axios
13
+ npm install axios
14
+
15
+ # Instalar la dependencia node-cache
16
+ npm install node-cache
17
+
18
+ {
19
+ "URL_service_auth": "URL de creacion de token",
20
+ "URL_service_revoke": "URL de revocacion de token",
21
+ "client_id": "id del cliente",
22
+ "client_secret": "secret del cliente",
23
+ "grant_type": "client_credentials",
24
+ "token_key" : "authToken (llave de token cache)",
25
+ "exp_key": "expires_at",
26
+ "exp_time": ""
27
+ }
package/index.js CHANGED
@@ -3,8 +3,7 @@ const cache = require("node-cache");
3
3
 
4
4
  const tokenCache = new cache({ stdTTL: 3600 }); // Cache con tiempo de vida de 1 hora
5
5
 
6
- async function getToken(req) {
7
- const body = req.body;
6
+ async function getToken(body) {
8
7
  const cachedToken = tokenCache.get(body.token_key);
9
8
  console.log("Usando token en caché");
10
9
  if (cachedToken && cachedToken.expires_at > Date.now()) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "token-verify-att",
3
- "version": "1.0.0",
4
- "private" : false,
3
+ "version": "1.0.2",
4
+ "private": false,
5
5
  "description": "Libreria para verificar tokens de autenticación",
6
6
  "main": "index.js",
7
7
  "keywords": [