Discuss this help topic in SecureBlackbox Forum

Clouds: Authenticate on Google Drive service with refresh token

When you have a refresh token, there's no need to authorize the user in the browser each time. Instead you can use the saved refresh token to access the user account. To do this:

  1. Put Client ID and Client Secret, obtained during registration, to TElGoogleDriveDataStorage.ClientID and TElGoogleDriveDataStorage.ClientSecret properties respectively. If the app uses an external browser, it's also needed to set TElGoogleDriveDataStorage.RedirectURL property in case if the authorization server requests to authorize manually.
  2. Put the refresh token to TElGoogleDriveDataStorage.RefreshToken property.
  3. Create an instance of TElHTTPSClient, which will be used as a transport, and put a reference to the newly created instance to TElGoogleDriveDataStorage.HTTPClient property.
  4. Call TElGoogleDriveDataStorage.StartAuthorization() method.

    If this method returns the empty string, this means that the application has connected to Box server successfully and can perform operations with user files. However you need to save the value of TElGoogleDriveDataStorage.RefreshToken property, as this property is changed with each successful connection, and the previous refresh token becomes invalid. So if you don't save the new refresh token, on the next launch your will need to authenticate the user again.

    If StartAuthorization() returns a non-empty string, this means that there was a problem using the refresh token (for example, it has expired). In this case you need to authenticate the user as described in "authenticate for the first time" how-to article.

How To articles about Google Drive cloud

Discuss this help topic in SecureBlackbox Forum