Have you recently started your android journey and started worrying about User Authentication? If yes, then this article is dedicated to solve your problem in minutes.
If you give it a read or follow the steps on the way, I can guarantee that you will get to learn the integration of this SDK in the easiest way in your android project.
Why to include SAWO in your project🤔
You might be thinking what's that special in this tool for which I am giving my time to learn about its implementation. So here are some points which will make you reading time as an investment!
Discussing about the technical side🧑💻
The paswordless system is based on strong cryptographic encryption. The user don't need to worry about complex strings, numbers and symbols.
A password, howsoever complex it may be, can get compromised by some attacks like brute-force attack, phishing or any social engineering methods. But crypto based password-less authentications ensures the users security.
It decreases the bounce rates and making the user authentication process smooth.
Discussing about some developer and user ease side😁
No need to spend time making the frontend
No need to write Login, SignUp and ForgetPassword logics
User don't have to worry about remembering their passwords.
Sawo provides cheap priced account upgradation. Check out this if you want Pricing
Note: Minimum SDK version of the project should be 24
So without any further delay lets jump into integration part. The steps are divided into two categories depending your language of preference (java or Kotlin):
- Set up your SAWO Dashboard by signing up here : Sawo SignUp. Then you will find your Dashboard and there you have to create a new Project> Select Android> Type the name of your Project and boom, an csv file with name sawo_keys will get downloaded on your system. Open it and you will get your API_KEY🔒 and SECRET_KEY 🤫 .
- After the successful project creation, go to the
settings.gradle
and add this to repositories block :maven { url 'https://jitpack.io' }
In your app level
build.gradle
add the following dependencies :implementation 'com.github.sawolabs:Android-SDK:0.2.0'
Now make a button on you auth/login layout or anything you want the user to interact with before he is shifted to Sawo Layout Container.
- Now, move to your AuthActivity/LoginActivity (any other activity/fragment where you are working on authentications) and use the Sawo class you get from the dependencies as (supposing you want to call the sdk after the button is clicked):
Implementation using Java 🚀
Button login=findViewById(R.id.loginBtn);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
'create sawo instance for Sawo Class'
Sawo sawo = new Sawo(AuthActivity.this,"your_API KEY","Your_SECRET_KEY");
'if you want to sent the OTP on email -->'
sawo.login("email",MainActivity.class.getName());
'if you want to sent the OTP on mobile number -->'
sawo.login("phone_number_sms",MainActivity.class.getName());
}
});
Implementation using Kotlin 🚀(Here I am using View Binding: Learn Here)
binding.loginBtn.setOnClickListener {
'create sawo instance for Sawo Class'
val sawo = Sawo(
this,
"your_API_KEY",
"your_SECRET_KEY"
)
'if you want to sent the OTP on email -->'
sawo.login(
"email",
MainActivity::class.java.name
)
'if you want to sent the OTP on mobile number -->'
sawo.login(
"phone_number_sms",
MainActivity::class.java.name
)
}
Let me explain each of these code :
Firstly we created a sawo named instance for the Sawo class and passed the context, API KEY and SECRET KEY.
Then we use the function named login and pass two parameters: identifierType and the Activity to which the user will intent after successful login. Both the identifier options are shown in the above code (use any one).
Must be wondering what to do next right? Nothing, you are all set with your authentication system. So cool right? Do you want to know more features of this?
Some extended features🤩:
You can save the user signup details as a payload and send it to the HomeActivity (or anything you prefer the user to intent after login) through intents and its getStringExtra() function. Explore more on this at Android-Sawo
You can customize your login layout from your personal dashboard🔥.
You can also add more fields as per the project requirement from the dashboard itself.
Overall, Sawo is the best Password-less Authentication you can get for your next project. It can be implemented within minutes without worrying about the layout designing and user input checks. The SDK automatically does everything for you. The Sawo team is actively adding features, maintaining it to its best and keeping the users feedback as their top priorities.
I am sure you will definitely explore this awesome tool. To know more about it: Sawo