Special characters in the components (label, issuer) must be URI-encoded, i.e. replace " " by "%20" (and not by "+") and so on.
Possible solution: Apply following encoding to the label parts (issuer and account) and to the issuer parameter. Note that it is valid to encode the : in the label as well, but this is not required.
Your
HOTPGenerator#getURI
method is mighty wrong." "
by"%20"
(and not by"+"
) and so on. Possible solution: Apply following encoding to the label parts (issuer and account) and to the issuer parameter. Note that it is valid to encode the:
in the label as well, but this is not required.new Base32().encodeToString(secret)
using Apache Commons Codec Base32 implementation