Reputation: 41
I´m trying to use GameService API to list a game AchievementDefinitions, but always return [500] No individual errors. I´m using ServiceAccountCredential to authenticate.
I tried two ways to auth
string credPath = @"C:\Downloads\game-bd201016b65f.json";
var json = File.ReadAllText(credPath);
var cr = JsonConvert.DeserializeObject<dynamic>(json);
var xCred = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(cr.client_email.ToString())
{
Scopes = new[] { GamesService.Scope.Games }
}.FromPrivateKey(cr.private_key.ToString()));
var initializer = new BaseClientService.Initializer()
{
HttpClientInitializer = xCred
};
GamesService gamesService = new GamesService(initializer);
var a = gamesService.AchievementDefinitions.List().Execute();
and
GoogleCredential credential;
using (var stream = new FileStream(@"C:\game-bd201016b65f.json", FileMode.Open, FileAccess.Read, FileShare.Read))
{
credential = GoogleCredential.FromStream(stream);
}
if (credential.IsCreateScopedRequired)
{
credential = credential.CreateScoped(GamesService.Scope.Games);
}
var initializer = new BaseClientService.Initializer()
{
HttpClientInitializer = credential
};
Can be an API error when running in .NET?
Upvotes: 3
Views: 104
Reputation: 41
GameService API is used to get user authenticated information and what i need is get the Game information, to get the game information need to use GameService Management API. Using GameService Management API i can auth with ServiceAccountCredential and get the game information.
Upvotes: 1