diff --git a/tools/walletextension/httpapi/utils.go b/tools/walletextension/httpapi/utils.go index c7acc16b8c..e367856abc 100644 --- a/tools/walletextension/httpapi/utils.go +++ b/tools/walletextension/httpapi/utils.go @@ -25,10 +25,13 @@ func getUserID(conn UserConn) ([]byte, error) { // try getting userID (`token`) from query parameters and return it if successful userID, err := getQueryParameter(conn.ReadRequestParams(), common.EncryptedTokenQueryParameter) if err == nil { - if len(userID) != common.MessageUserIDLenWithPrefix { - return nil, fmt.Errorf(fmt.Sprintf("wrong length of userID from URL. Got: %d, Expected: %d", len(userID), common.MessageUserIDLenWithPrefix)) + if len(userID) == common.MessageUserIDLenWithPrefix { + return hexutils.HexToBytes(userID[2:]), nil + } else if len(userID) == common.MessageUserIDLen { + return hexutils.HexToBytes(userID), nil } - return hexutils.HexToBytes(userID[2:]), err + + return nil, fmt.Errorf(fmt.Sprintf("wrong length of userID from URL. Got: %d, Expected: %d od %d", len(userID), common.MessageUserIDLenWithPrefix, common.MessageUserIDLen)) } return nil, fmt.Errorf("missing token field")