You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JWT token based Authentication system integrated with Retrofit followed by MVVM Architecture.
Describe the solution you'd like
initialize retrofit
API Endpoint details /server/README.md (/register, /login, /refresh)
Do not Store Refresh Token directly inside SharedPreference
Store Refresh token HASH. (Using SHA-256)
Additional context
SHA-256 implementation -
public static byte[] getSHA(String input) throws NoSuchAlgorithmException {
// Static getInstance method is called with hashing SHA
MessageDigest md = MessageDigest.getInstance("SHA-256");
// digest() method called
// to calculate message digest of an input
// and return array of byte
return md.digest(input.getBytes(StandardCharsets.UTF_8));
}
public static String toHexString(byte[] hash) {
// Convert byte array into signum representation
BigInteger number = new BigInteger(1, hash);
// Convert message digest into hex value
StringBuilder hexaString = new StringBuilder(number. toString(16));
// Pad with leading zeros
while (hexaString.length() < 32) {
hexaString.insert(0, '0');
}
return hexaString.toString();
}
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
JWT token based Authentication system integrated with
Retrofit
followed by MVVM Architecture.Describe the solution you'd like
/server/README.md
(/register
,/login
,/refresh
)Refresh Token
directly inside SharedPreferenceAdditional context
SHA-256
implementation -The text was updated successfully, but these errors were encountered: