2

if i create a new driveservice like this:

 public void CreateDriveService()
    {
        string SERVICE_ACCOUNT_EMAIL = "xxxxxxx-xxxxxxxxxxxxxx@developer.gserviceaccount.com";
        string SERVICE_ACCOUNT_PKCS12_FILE_PATH = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Application.ExecutablePath), @"xxxxxxxxxxxxxxx-privatekey.p12");
        X509Certificate2 certificate = new X509Certificate2(SERVICE_ACCOUNT_PKCS12_FILE_PATH, "notasecret",
            X509KeyStorageFlags.Exportable);

        var provider = new AssertionFlowClient(GoogleAuthenticationServer.Description, certificate)
        {
            ServiceAccountId = SERVICE_ACCOUNT_EMAIL,
            Scope = DriveService.Scopes.Drive.GetStringValue(),              
        };

        var auth = new OAuth2Authenticator<AssertionFlowClient>(provider, AssertionFlowClient.GetState);
        auth.LoadAccessToken();


        _service = new DriveService(auth);
    }

I get a new driveservice, but if i watch the access token it has 29.05.2014 12:25:11 as AccessTokenExpirationUtc but now it is 29.05.2014 13:25:11! How it is possible??? I already have changed the time zone on google-drive but still same problem....

Thanks in advance

pinoyyid
  • 21,499
  • 14
  • 64
  • 115

1 Answers1

2

When comparing any two times, they must have the same timezone. The access token expiration time is given as UTC. If you want to see how far in the future that is, you should compare it with your system's current time in UTC. This question How to make date.getTime() returns UTC time? gives an example of how to do that

Community
  • 1
  • 1
pinoyyid
  • 21,499
  • 14
  • 64
  • 115