Made redirect_uri mandatory

Refactored the mandatory check to its own method and reorganized the
initialization statements to be inside the try block.
Noted that the refresh() method does nothing

Satisfies Sonar.