Hi everyone, welcome to MVVM Login Example Android Tutorial.
An authentication system is required in almost any kind of application. You name any application, Facebook, WhatsApp, Ola, Uber and you will find an Authentication System there.
Most commonly used authentication method is the email and password authentication, that we see almost everywhere. And in this post we will learn implementing a proper authentication system for our android project.
Table of Contents
How Authentication Works in Android?
As we already know, android is kind of FRONT-END technology. And we do not authenticate the user on the app side. We need some kind of backend where we can authenticate our users.
This diagram explains how authentication happens in the android application.
Now we need a backend that will actually authenticate our application’s user. So before moving ahead you need to check this Building Login API with OAuth2 Tutorial.
For this post I am assuming that you already have your backend API ready.
What is MVVM?
We know how Authentication works. Now let’s understand “What is MVVM?”.
MVVM or Model-View-ViewModel is an architectural pattern.
I already have a complete Step by Step guide that explains about MVVM. So before moving ahead, you can check the Android MVVM Tutorial first; and if you are already aware of it, just skip this step.
MVVM Login Example Android
After completing all the above pre requisites, finally you can make an android project to implement the Authentication.
The following playlist will cover about building a proper Login System in your android project with MVVM architecture.
You will learn the following in the above playlist:
- Designing Android Login Screen and Signup Scree.
- Using ViewDataBinding for Designs.
- Setting Up Retrofit Client for making network requests.
- Using Coroutines for Asynchronous Function Calls.
- Following MVVM Architecture with Repository Pattern for the Project.
MVVM Login Example Source Code
You also have the access of the Source Code of the project. My recommendation is don’t get the source code First.
First you need to try on your own, follow the video lessons and try to do it yourself.
In case you are facing an issue, then only go to the source code for reference.
Hi, my name is Belal Khan and I am a Google Developers Expert (GDE) for Android. The passion of teaching made me create this blog. If you are an Android Developer, or you are learning about Android Development, then I can help you a lot with Simplified Coding.
4 thoughts on “MVVM Login Example Android using RESTFul API with OAuth2”
gud evening sir i am getting user = null in responce can you please help me
Hello, Have resolved your problem?
Can you please provide the login credentials?
hello friend i have learned with your tutorial. but i am looking for solution in my project. when trying to login in my app, a Restfull api send me a response called user_api_hash( a string). this user_api_hash is like a key to authenticate but each users of the app will recceive the hash. how may i evoid this to directly authenticate users ?