Git Product home page Git Product logo

flujo-autenticacion-node's Introduction

Creacion de api basica para autenticacion

Flujo basico de autenticaciín

  • Autenticacion Basic
  • Token con Bearer
  • Rutas publicas y privadas

Postman (Configuración de variables de entorno)

  1. Ruta privada (GET) => {{URL}}/api/private

  2. Bearer token => {{TOKEN}}

Obtenemos el Token con la autenticacion Basic

  1. Ruta publica auth (POST) => {{URL}}/api/token

  2. Respuesta de ejemplo ruta publica auth (POST) =>

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI2NDM3MGI3MDcyNTllMWRhYmMzNThmNDkiLCJuYW1lIjoiVGVzdCIsImlhdCI6MTY4MTc3OTY1MiwiZXhwIjoxNjgxNzg2ODUyfQ.dniJcMkx_hmYsAB7vSMrGFqcnACO5TQb3Er_rwN1_Yo"
}
  1. En el apartado de Tests añadimos el código para obtener el token y agregarlo a una variable de entorno =>
const token = pm.response.json().token;
pm.environment.set('TOKEN', token);
  1. En este momento al obtener el token se incrustara en la variable de entorno del endpoint de ruta privada que esta al principio => {{TOKEN}}

Uso de criptografia para JWT (Ejecutar)

openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -in private.pem -outform PEM -pubout -out public.pem

flujo-autenticacion-node's People

Contributors

angelfgdeveloper avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.