Usando JWT para Autenticação em uma Aplicação Golang
Blog post from Vonage
Victor Steven, a self-taught full-stack developer with over five years of experience, shares an extensive tutorial on implementing JSON Web Token (JWT) authentication in a Golang RESTful API, using the Vonage Messages API for notifications. The tutorial demonstrates creating, using, and invalidating JWTs, highlighting their advantages such as being stateless, secure, and having configurable expiration times. It details setting up a simple ToDo API, leveraging libraries like gin for HTTP requests and redis for storing JWT metadata, allowing immediate token invalidation upon user logout. The guide also covers the creation of access and refresh tokens, ensuring a smooth user experience by allowing token renewal without repeated logins, and integrating the Vonage API to notify users via SMS when a ToDo is created. This comprehensive walkthrough also suggests improvements, such as using a real database and front-end frameworks like React or Vue.js to fully utilize the refresh token feature with Axios Interceptors.