Fixed a problem with the authentication window not dismissed even when the authorization was granted, modified the way to understand if the authentication process has ended