Let’s create a new endpoint named ‘/auth’ that will authenticate an existing user and generate a JWT token if the credentials are valid and set them up in response header. JWT token can also be set in a cookie (preferably an httpOnly cookie, so that it is not accessible to client-side javascript) but in this session we will be setting it up in response header.
#go #golang