11

MVVM Login Example Android using RESTFul API with OAuth2

 3 years ago
source link: https://www.simplifiedcoding.net/mvvm-login-example-android/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

MVVM Login Example Android using RESTFul API with OAuth2

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.

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.

MVVM Login Example Android

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.

So that is all for this post friends. In case you have any question related to this MVVM Login Example then feel free to comment it below. Thank You.

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.

Checkout these tutorials as well:

  • Android Data Binding Library Tutorial with Firebase
  • Laravel REST API Authentication using Passport
  • Android Networking Tutorial with Retrofit, PHP and MySQL
  • Bottom Navigation Android Example using Fragments
  • Bottom Sheet Android Tutorial - Working with BottomSheet
  • Android ViewModel using Retrofit - ✅ A Simple Tutorial

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK