I have asp.net mvc project hosted on windows azure, i am using google analytic service and its authenticating properly on my localhost however on hosted server it does not work. it gives me this error "the redirect URI in the request, callback, does not match the ones authorized for the OAuth client"
My hosted URL is "http://mysite.azurewebsites.net/" and the callback url i am giving in google console is "http://ispycms.azurewebsites.net/Dashboard/Index"
Below is the C# code for authenticating to google analytic, note that i am using service instance to make request, i have placed this code in Index method of Controller Dashboard.
[SessionExpireFilter]
public ActionResult Index()
{
var result = new AuthorizationCodeMvcApp(this, new AppAuthFlowMetadata()).
AuthorizeAsync(CancellationToken.None);
if (result.Result.Credential != null)
{
service = new AnalyticsService(new BaseClientService.Initializer
{
HttpClientInitializer = result.Result.Credential,
ApplicationName = "iSPY Stats"
});
}
//Request data
// make a request
var request = service.Data.Ga.Get(
"ga:" + profileId,
"2016-01-01",
"2016-05-05",
"ga:totalEvents");
request.Dimensions = "ga:eventCategory,ga:eventAction,ga:eventLabel,ga:date,ga:hour,ga:minute";
request.Filters = "ga:eventCategory==Pack;ga:eventAction==Open";
// run the request and get the data
return request.Execute();