Changed the logic to parse the authorization code