Implementing JWT token authentication on Android with Clean Architecture

Overview

Implementando autenticação com token JWT no Android com Clean Architecture

Implementar autenticação com Token JWT no Android não é uma tarefa fácil. É preciso ter um código bem organizado e com uma boa arquitetura para facilitar o armazenamento e gerenciamento de um token na aplicação, de forma segura e prática.

Nesta aula, iremos aprender a requisitar, armazenar e gerenciar tokens JWT de uma API Rest, utilizando a Clean Architecture e boas práticas de desenvolvimento Android. Além disso tudo, iremos aprender a assinar automaticamente todas as requisições feitas para os endpoints protegidos do serviço utilizando um interceptor do OkHttp.

Requisitos para rodar a API Node localmente

  • Node.js v14+ (.nvmrc incluso no projeto)
  • Um banco PostgreSQL (existe um docker-compose no projeto, para subir o banco usando Docker)

Como rodar a API Node localmente

  1. Antes de tudo, acesse a pasta auth-jwt que está na raiz do projeto Android;
  2. Rode o comando docker-compose up -d --force-recreate --renew-anon-volumes, para rodar o banco de dados localmente com Docker;
  3. Rode o comando npm install;
  4. Rode o comando npm run sequelize:migrate para gerar as tabelas;
  5. Rode o comando npm run dev para rodar o projeto usando nodemon.

Expert

Douglas Motta
You might also like...
Accounting-App - An Android app built with Kotlin, Material, Jetpack Compose, Hilt, Room, Coroutines, Data-Store, MVVM-Clean Architecture and JUnit tests My own approach to what I think an Android MVVM project with Clean Architecture should look like with Dagger-Hilt as Dependency Injector engine
My own approach to what I think an Android MVVM project with Clean Architecture should look like with Dagger-Hilt as Dependency Injector engine

MVVM Project Hilt Introducción Este proyecto es mi visión particular, ni mejor ni peor (sólo una más) que cualquier otra aproximación a lo que yo enti

KataContacts written in Kotlin. The main goal is to practice Clean Architecture Development

KataContacts written in Kotlin We are here to practice Clean Architecture Development. Clean Architecture is a way of structuring code. We are going t

A simple demo project based on MVVM clean architecture and material design & animations.
A simple demo project based on MVVM clean architecture and material design & animations.

GithubFollows A simple demo project based on MVVM clean architecture and material design & animations. Architecture Specs & Open-source libraries Mini

A clean architecture example. Using Kotlin Flow, Retrofit and Dagger Hilt, etc.
A clean architecture example. Using Kotlin Flow, Retrofit and Dagger Hilt, etc.

android-clean-architecture A clean architecture example. Using Kotlin Flow, Retrofit and Dagger Hilt, etc. Intro Architecture means the overall design

Simple Note App With MVVM Clean Architecture
Simple Note App With MVVM Clean Architecture

NoteWakeup Simple Note App With MVVM Clean Architecture ✍🏽 Simple Note App. Here i demonstrate the use of Modern Android development tools - (Kotlin,

 A program written entirely in Kotlin using the principles of Clean Architecture according to the MVVM pattern
A program written entirely in Kotlin using the principles of Clean Architecture according to the MVVM pattern

A program written entirely in Kotlin using the principles of Clean Architecture according to the MVVM pattern. An application that shows a list of ani

Kotlin multi platform project template and sample app with everything shared except the UI. Built with clean architecture + MVI
Kotlin multi platform project template and sample app with everything shared except the UI. Built with clean architecture + MVI

KMMNewsAPP There are two branches Main News App Main The main branch is a complete template that you can clone and use to build the awesome app that y

A movie & TV show exploration app that implements MVVM design pattern by following the clean architecture principles, using TMDB API.
A movie & TV show exploration app that implements MVVM design pattern by following the clean architecture principles, using TMDB API.

🎬 Movie App 📺 A movie & TV show exploration app that implements MVVM design pattern by following the clean architecture principles, using TMDB API.

Owner
Rocketseat Experts Club
Organização que armazena o código produzido nos projetos do Experts Club 🚀 Organização principal: @Rocketseat
Rocketseat Experts Club
A simple (and naive) RESTful API made with Ktor, jasync-sql and JWT.

A simple (and naive) RESTful API made with Ktor, jasync-sql and JWT. Route Method Description /account POST Create a new account /account DELETE Delet

null 2 Nov 4, 2021
SpringBoot SpringDoc JWT

springboot-springdoc-jwt Things todo list Clone this repository: git clone https

Hendi Santika 1 Feb 7, 2022
This is an example of a simple application with layered software base on clean-architecture as application architecture and mvvm as presentation architecture

This is an example of a simple application with layered software base on clean-architecture as application architecture and mvvm as presentation archi

null 3 Jul 2, 2021
Learning Project (Story App) For Applying Android Architecture Components And Clean Architecture Using MVVM With Kotlin

Learning Project (Story App) For Applying Android Architecture Components And Clean Architecture Using MVVM With Kotlin. Implemented by Clean Architecture, Hilt, MVVM, LiveData, Coroutines, Retrofit2, Glide

Samad Talukder 4 Sep 27, 2022
Firebase Authentication plugin for Ktor framework.

Firebase Authentication is a Ktor plugin which verifies requests authorized by a Firebase Auth Id Token.

Manav Tamboli 2 Jul 16, 2022
Login-and-Signup - Simple Login-and-Signup with authentication using Firebase API

Simple Login-and-Signup with authentication using Firebase API. Log in Sign Up

Indresh Goswami 0 Mar 25, 2022
Simple authentication provider for Ktor that verifies presence of the API key in the header

Ktor API Key Authentication Provider Simple authentication provider for Ktor that verifies presence of the API key in the header. Useful if you want t

Lukas Forst 6 Oct 28, 2022
User Authentication ( Compose Ktor Server MongoDB)

Utilising Security in android for Authentication and Authorization for Android I would be using mongo db to perform all basic operations no need for f

Michael Enoma 0 May 2, 2022
A custom OTP view to enter a code usually used in authentication

A custom view to enter a code usually used in authentication. Different types of OTPViews. Easy to use and configure your own view and character of OTP using all the attributes.

Simform Solutions 48 Aug 30, 2022
Movie Android App written in Kotlin, MVVM, Clean Architechture, Modularized, Coroutines, Android Architecture Components and Hilt

Movie Android App written in Kotlin, MVVM, Clean Architechture, Modularized, Coroutines, Android Architecture Components and Hilt.

Klejvi Kapaj 16 Dec 27, 2022