Fix the implementation for the authorization code flow