Skip to content

Android: Authentication  #6

@samiurprapon

Description

@samiurprapon

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

  • 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(); 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions