I am working on a dll
that is used by web form application. One of dll's features is creating Google CalendarService
and using it. When I run the webforms on my local host everything is running smoothly. However, if I run it from Azure websites
'GoogleWebAuthorizationBroker.AuthorizeAsync' method throws HttpListenerException (0x5): Access is denied
Here is a stack trace:
[HttpListenerException (0x5): Access is denied]
Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +82
Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) +71
Mosoft.Integrations.CalendarService.<GetCredentials>d__2.MoveNext() +362
[AggregateException: One or more errors occurred.]
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +3833113
System.Threading.Tasks.Task`1.GetResultCore(Boolean aitCompletionNotification) +73
System.Threading.Tasks.Task`1.get_Result() +10900681
Mosoft.Integrations.CalendarService.GoogleCalendar..ctor(Int32 userID) +38
WebFormsDemo.ModalCreate.CreateServices() +35
WebFormsDemo.ModalCreate.Page_Load(Object sender, EventArgs e) +240 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
And this is how I set up the credentials
private static async Task<BaseClientService.Initializer> GetCredentials(int userID)
{
ClientSecrets secrets = new ClientSecrets
{
ClientId = CLIENT_ID,
ClientSecret = CLIENT_SECRET
};
UserCredential googleCredential = await GoogleWebAuthorizationBroker.AuthorizeAsync(secrets,
new[] { Google.Apis.Calendar.v3.CalendarService.Scope.Calendar }, userID.ToString(), CancellationToken.None, new MyDataStore());
var initializer = new BaseClientService.Initializer
{
HttpClientInitializer = googleCredential,
ApplicationName = "MyCalendar"
};
return initializer;
}
Any suggestions what could be wrong? Or pointing towards right direction?