-1

I have done login and registration activity using rest API. But in login I used only Mobile number editext. And in registration I used password. So I want to use that password in login. Means user should enter that password while he used during registraton. So how to do that?

2 Answers 2

1

If you're going to store passwords, make sure you store them in EncryptedSharedPreferences. You do not have to encrypt them manually as the library will take care of it.

If you need/want more explanation on this and how it works, check out some articles about it on the web - there are plenty.

Sign up to request clarification or add additional context in comments.

Comments

-1

If your using Kotlin, saving password in Shared Preferences could look like this:

Initialize Shared Preferences:

var prefs: SharedPreferences prefs = getSharedPreferences("name_of_your_file", Context.MODE_PRIVATE) 

Save password to it:

with (prefs.edit()) { putString("password", etPasword.text) apply() } 

If you want to access this stored password, you can do it like this:

val password = prefs.getString("password", "default_value") 

2 Comments

Actually I'm using java
Always store the credentials as hashes. Here I found implementation of SHA256. You can create your own hash function too. Also I would highly recommend to use encrypted share preferences to store the credentials. I found a good example implementation.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.