title: Azure WebSites denies access to Google Api
body: <p>I am working on a <code>dll</code> that is used by web form application. One of dll's features is creating Google <code>CalendarService</code> and using it. When I run the webforms on my local host everything is running smoothly. However, if I run it from Azure websites </p>
  
  <blockquote>
    <p>'GoogleWebAuthorizationBroker.AuthorizeAsync' method throws
    HttpListenerException (0x5): Access is denied</p>
  </blockquote>
  
  <p>Here is a stack trace:</p>
  
  <pre><code>[HttpListenerException (0x5): Access is denied]
  Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +82   
  Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) +71   
  Mosoft.Integrations.CalendarService.&lt;GetCredentials&gt;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
  </code></pre>
  
  <p>And this is how I set up the credentials</p>
  
  <pre><code>private static async Task&lt;BaseClientService.Initializer&gt; 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;
      }
  </code></pre>
  
  <p>Any suggestions what could be wrong? Or pointing towards right direction?</p>