I'm having some issues with google API while generating the token. The code works fine in the local machine but the publish version gives "Access is denied" error. I know that must be something related with the folder's permissions, but I don't know how to solve it. Actually our authorization function is like this:
public static DriveService AuthenticateOauth(string clientId, string clientSecret, string userName)
{
       String folder = System.Web.HttpContext.Current.Server.MapPath("/App_Data/MyGoogleStorage/");
       string[] scopes = new string[] { DriveService.Scope.Drive };
       // here is where we Request the user to give us access, or use the Refresh Token that was previously stored in %AppData%
       UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret }
               , scopes
               , userName 
               , CancellationToken.None
               , new FileDataStore(folder)).Result;
       DriveService service = new DriveService(new BaseClientService.Initializer()
       {
           HttpClientInitializer = credential,
           ApplicationName = "Drive API",
       });
       return service;
}
The website is written in ASP NET MVC 5 and is hosted in Azure websites.
Thank you for your help.
 
    
 
    