Can you please provide - Google Bigquery dependency latest Dotnet NUGET package names, because the Bigquery example programs are not working

StackOverflow https://stackoverflow.com/questions/22954187

문제

Need help to get Google Bigquery dependency latest Dotnet NUGET package names, because the Bigquery example programs are not working and it is giving the dependecy reference expections at IAuthorizationState

eError  1   The type 'DotNetOpenAuth.OAuth2.IAuthorizationState' exists in both 'c:\Echelon\GoogleDownloads\google-api-dotnet-client-1.8.1.source\Src\GoogleApis.Authentication.OAuth2.Tests\bin\Release\DotNetOpenAuth.dll' and 'c:\Users\Srinivasa\Documents\Visual Studio 2013\Projects\BigQueryConsole1\packages\DotNetOpenAuth.OAuth2.Client.4.3.4.13329\lib\net40-full\DotNetOpenAuth.OAuth2.Client.dll'  c:\users\srinivasa\documents\visual studio 2013\Projects\BigQueryConsole1\BigQueryConsole1\Program.cs   37  24  BigQueryConsole1




  using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DotNetOpenAuth.OAuth2;
using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;

using Google.Apis.Bigquery.v2;
using Google.Apis.Util;

namespace BigQueryConsole1
{
    class Program
    {
        public static void Main(string[] args)
        {
            // Register an authenticator.
            var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);

            // Put your client id and secret here (from https://developers.google.com/console)
            // Use the installed app flow here.
            provider.ClientIdentifier = "asdfasd";
            provider.ClientSecret = "asdfasdf";

            // Initiate an OAuth 2.0 flow to get an access token
            var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);

            // Create the service.
            var service = new BigqueryService(auth);

            // Do something with the BigQuery service here
            // Such as... service.[some BigQuery method].Fetch();
        }

        private static IAuthorizationState GetAuthorization(NativeApplicationClient arg)
        {
            // Get the auth URL:
            IAuthorizationState state = new AuthorizationState(new[] { BigqueryService.Scopes.Bigquery.GetStringValue() });
            state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
            Uri authUri = arg.RequestUserAuthorization(state);

            // Request authorization from the user (by opening a browser window):
            Process.Start(authUri.ToString());
            Console.Write("  Authorization Code: ");
            string authCode = Console.ReadLine();
            Console.WriteLine();

            // Retrieve the access token by using the authorization code:
            return arg.ProcessUserAuthorization(authCode, state);
        }
    }
}   
도움이 되었습니까?

해결책

You are using an old version of the library.

The latest NuGet package is available in: http://www.nuget.org/packages/Google.Apis.Bigquery.v2/

Take a look in our samples repository for samples on Google APIs (Unfortunately, we don't have a sample for BigQuery)

You should also take a look in our Getting Started guide and to be more specific in the OAuth 2.0 page.

Good luck!

[UPDATE] We improved the OAuth 2.0 library significantly. Take a look in our blog announcement from October 2013 - http://google-api-dotnet-client.blogspot.com/2013/10/announcing-release-of-160-beta-new.html. In the OAuth 2.0 page I mentioned above there are the exact details of how to set your application to work with Google authorization. The library supports the OAuth 2.0 flows in Windows Phone, Windows 8 application and regular .NET 4.0 and higher.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top