versucht, Google Analytics-Konto dynamisch von ASP.NET MVC mit "Provisioning API (https://developers.google.com/analytics/devguides/config/provisioning/v3/devguide)" zu erstellen. Ich habe den ersten Schritt gemacht: Authentifizierung, Autorisierung und ich habe ein Zugriffs-Token bekommen, während ich den zweiten Schritt "Create a Account Ticket mit der Provisioning API" gemacht habe und einen Fehler "unauthorised access" bekommen habe. Hier ist der Code, den ich dafür bin mit:Google Analytics-Konto dynamisch
var requestBody = '{"kind":"analytics#accountTicket",' +
'"account":{"name":"GATest"},"webproperty":{"name":"MyPortal","websiteUrl":"mywebappsurl"},' +
'"Scope":"https://www.googleapis.com/auth/analytics.provision",' +
'"profile":{name:"PortalDev"},"redirectUri":"http://localhost:56599/Home/Tos/"}';
alert(body);
var response = $.ajax({
url: "https://www.googleapis.com/analytics/v3/provisioning/createAccountTicket",
method: "post",
dataType: 'json',
data: JSON.stringify(requestBody),
success: function (response) {
alert("success");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Status: " + textStatus); alert("Error: " + errorThrown);
}
});
Eine Sache, die ich weiß, ist, ich bin nicht das Zugriffstoken überall in dieser Anfrage zu erwähnen, aber ich weiß nicht, wo es angeben werden müssen .