Preheat the oven to 350°F (175°C).
Coarsely shred the peeled sweet potato using a grater.
Transfer the grated sweet potato to a bowl filled with cold water. Stir it gently several times, then pour off the water.
Press the shredded sweet potato firmly in a clean kitchen towel or paper towels to remove as much moisture as possible.
In a medium mixing bowl, combine the drained sweet potato with the grated onion, eggs, flour, kosher salt, and black pepper to taste.
Stir until the mixture is evenly blended and holds together as a uniform hash brown batter.
Warm the oil in a large skillet set over medium heat.
Drop heaping tablespoons of the sweet potato mixture into the hot oil.
Use a spatula to lightly press each portion into an even patty shape.
Cook the patties for 3–4 minutes, or until the underside becomes lightly browned.
Turn each hash brown over and cook for another 3–4 minutes, allowing the second side to brown as well.
As each batch finishes browning, transfer the patties to a baking sheet.
Place the filled baking sheet in the preheated oven.
Bake for 10–12 minutes, or until the hash browns are fully cooked and crisp.
Remove the hash browns from the oven once baking is complete.
Serve immediately while hot, with sour cream if desired.