In this work, polyaniline (PANI) and its doped state with microfiber morphologies were easily synthesized by a chemical route under the oxidative polymerization, in which the polymerization was performed in an acidic medium (protonic acids). In situ polymerization of aniline reacted with the chloride and sulfate ions of hydrochloric and sulfuric acid, respectively. The microfiber-like morphology of undoped and HCl doped PANI was observerd. The X-Ray diffraction patterns represented that H2SO4 doped PANI was crystalline in nature. The effects of dopant acids on its optical properties were discussed. The strong interaction between chloride and sulfate ions with the ammonium group of PANI has been explained. The microfiber and granular morphology for HCl and H2SO4 doped PANI were observed. The redshifts were observed for the microfiber nature of doped PANI. These analytical results confirmed that the prepared PANI was in the doped state. Further, we found that the prepared PANI can be used for the fabrication of polymer solar cells.