JWT authentication

user authenticate with server using credentials

server validates credentials and return user a JSON web token

mindmap on jwt when learning from articles jwt how jwt works jwt2 jwt files jwt3

testing using postman

receiving cookie from posting authenticate method for the person jwt4 using cookie to access person data jwt5

Login

get user input from html form (button calls javascript login_user()

connect frontend to backend

  • URL for deployment (backend server)
    // URL for deployment
     var url = "https://serafina.tk"
     // Local testing
     url = "http://localhost:8192"
     // Authenticate endpoint
     const login_url = url + '/authenticate';
    
  • /authenticate (jwt - user post /authenticate with email and password) login

javascript login_user()

  • get email and password input from users login

  • fetch jwt

    • If not successful - error message
    • If successful - redirect to gallery page (window.location.href = "/gallery") login

Demonstration login login