Esempio n. 1
0
        /// <summary>
        ///     Gets the access token from Google
        /// </summary>
        /// <param name="deviceCode"></param>
        /// <returns>tokenResponse</returns>
        public static async Task<TokenResponseModel> GetAccessToken(DeviceCodeModel deviceCode)
        {
            //Poll until user submitted code..
            TokenResponseModel tokenResponse;
            do
            {
                await Task.Delay(2000);
                tokenResponse = await PollSubmittedToken(deviceCode.device_code);
            } while (tokenResponse.access_token == null || tokenResponse.refresh_token == null);

            return tokenResponse;
        }
Esempio n. 2
0
        /// <summary>
        ///     Gets the access token from Google
        /// </summary>
        /// <param name="deviceCode"></param>
        /// <returns>tokenResponse</returns>
        public static async Task <TokenResponseModel> GetAccessToken(DeviceCodeModel deviceCode)
        {
            //Poll until user submitted code..
            TokenResponseModel tokenResponse;

            do
            {
                await Task.Delay(2000);

                tokenResponse = await PollSubmittedToken(deviceCode.device_code);
            } while (tokenResponse.access_token == null || tokenResponse.refresh_token == null);

            return(tokenResponse);
        }
Esempio n. 3
0
        /// <summary>
        ///     Gets the access token from Google
        /// </summary>
        /// <param name="deviceCode"></param>
        /// <returns>tokenResponse</returns>
        public static async Task<TokenResponseModel> GetAccessToken(DeviceCodeModel deviceCode)
        {
            //Poll until user submitted code..
            TokenResponseModel tokenResponse;
            do
            {
                await Task.Delay(2000);
                tokenResponse = await PollSubmittedToken(deviceCode.device_code);
            } while (tokenResponse.access_token == null || tokenResponse.refresh_token == null);

            Logger.Write($"Save the refresh token in your settings: {tokenResponse.refresh_token}", LogLevel.None);

            return tokenResponse;
        }
        internal static async Task<TokenResponseModel> GetAccessToken(DeviceCodeModel deviceCodeResponse)
        {
            Console.WriteLine("Please visit " + deviceCodeResponse.verification_url + " and enter " +
                              deviceCodeResponse.user_code);

            //Poll until user submitted code..
            TokenResponseModel tokenResponse;
            do
            {
                await Task.Delay(2000);
                tokenResponse = await PollSubmittedToken(deviceCodeResponse.device_code);
            } while (tokenResponse.access_token == null || tokenResponse.refresh_token == null);
            Console.WriteLine("Logged in Google Account..");
            return tokenResponse;
        }
        public static async Task<TokenResponseModel> GetAccessToken(DeviceCodeModel deviceCode)
        {
            int count = 0;

            //Poll until user submitted code..
            TokenResponseModel tokenResponse;
            do
            {
                await Task.Delay(2000);
                tokenResponse = await PollSubmittedToken(deviceCode.DeviceCode);
                count++;
            } while (tokenResponse.AccessToken == null || tokenResponse.RefreshToken == null && count < 100);

            return tokenResponse;
        }
Esempio n. 6
0
        internal static async Task <TokenResponseModel> GetAccessToken(DeviceCodeModel deviceCodeResponse)
        {
            System.Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Please visit " + deviceCodeResponse.verification_url + " and enter " + deviceCodeResponse.user_code);

            //Poll until user submitted code..
            TokenResponseModel tokenResponse;

            do
            {
                await Task.Delay(2000);

                tokenResponse = await PollSubmittedToken(deviceCodeResponse.device_code);
            } while (tokenResponse.access_token == null || tokenResponse.refresh_token == null);
            return(tokenResponse);
        }
        /// <summary>
        ///     Gets the access token from Google
        /// </summary>
        /// <param name="deviceCode"></param>
        /// <returns>tokenResponse</returns>
        public static async Task <TokenResponseModel> GetAccessToken(DeviceCodeModel deviceCode)
        {
            //Poll until user submitted code..
            TokenResponseModel tokenResponse;

            do
            {
                await Task.Delay(2000);

                tokenResponse = await PollSubmittedToken(deviceCode.device_code);
            } while (tokenResponse.access_token == null || tokenResponse.refresh_token == null);

            Logger.Write($"Save the refresh token in your settings: {tokenResponse.refresh_token}", LogLevel.None);

            return(tokenResponse);
        }
        public static async Task <TokenResponseModel> GetAccessToken(DeviceCodeModel deviceCode)
        {
            int count = 0;

            //Poll until user submitted code..
            TokenResponseModel tokenResponse;

            do
            {
                await Task.Delay(2000);

                tokenResponse = await PollSubmittedToken(deviceCode.DeviceCode);

                count++;
            } while (tokenResponse.AccessToken == null || tokenResponse.RefreshToken == null && count < 100);

            return(tokenResponse);
        }