I'm trying to get the Android Management API working. I'm using the C# library available here https://www.nuget.org/packages/Google.Apis.AndroidManagement.v1
I've generated a service account and downloaded the json key for that service account. Then used the code below.
var client = new AndroidManagementService();
var signUpUrlsCreateRequest = client.SignupUrls.Create();
signUpUrlsCreateRequest.CallbackUrl = "https://localhost:5005";
signUpUrlsCreateRequest.ProjectId = "rms";
var json = "\\Downloads\\rms-c5ac188362d4.json";
var stream = new FileStream(json, FileMode.Open, FileAccess.Read);
var credentials = ServiceAccountCredential.FromServiceAccountData(stream);
signUpUrlsCreateRequest.Credential = credentials;
var result = signUpUrlsCreateRequest.Execute();
I'm getting the following error
Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. [401] Errors [ Message[Invalid Credentials] Location[Authorization - header] Reason[authError] Domain[global] ]
Any ideas of what I'm missing to get this to work?
Thank you