internal static GoogleScopes GetInstance()
 {
     if (instance == default)
     {
         instance = new GoogleScopes();
     }
     return(instance);
 }
        public async Task Login(IEnumerable <ValidScopes> validScopes)
        {
            validScopes = validScopes.Distinct();
            var scopes = GoogleScopes.EnumToString(validScopes);

            var clientSecrets = new ClientSecrets()
            {
                ClientId = ConfigClientId, ClientSecret = ConfigClientSecret
            };

            if (!IsTokenSet || !Scopes.EnsureContains(validScopes))
            {
                Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(clientSecrets, scopes, "user", CancellationToken.None);

                Token = Credential.Token;
            }
            if (IsTokenSet && IsTokenExpired && IsRefreshTokenPresent)
            {
                await GoogleWebAuthorizationBroker.ReauthorizeAsync(Credential, CancellationToken.None);
            }


            Scopes = validScopes;
        }