I read this doc.
We have experimental code.
var store = new FileDataStore("C:\\!Sources\\Tokens\\Analytics.Api.Auth.Store");
IAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = "id",
ClientSecret = "secred"
},
Scopes = new[] { AnalyticsService.Scope.AnalyticsReadonly },
DataStore = store
});
Google.Apis.Auth.OAuth2.Responses.TokenResponse token = new Google.Apis.Auth.OAuth2.Responses.TokenResponse();
token.RefreshToken = "token";
Google.Apis.Auth.OAuth2.UserCredential credential = new Google.Apis.Auth.OAuth2.UserCredential(flow, "Random", token);
var task=credential.RefreshTokenAsync(CancellationToken.None);// Ok. Access token !=null but Scope==null??????
task.Wait();
AnalyticsService service = new AnalyticsService(new BaseClientService.Initializer()
{
ApiKey = "apikey",
HttpClientInitializer = credential,
ApplicationName = "Analytics API Sample",
});
var param = service.Data.Ga.Get("ga:78203720", "2014-11-05", "2014-11-19", "ga:users");
Function service.Data.Ga.Get redirect to auth page. Maybe i use wrong function to obtain access token .
Субота, 22 листопада 2014 р. 15:53:41 UTC+2 користувач Kushan Shah написав: