Discuss this help topic in SecureBlackbox Forum

Clouds: Authenticate on OneDrive 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 Application ID and Application Secret (Application Secret is not needed if you use an embedded browser), obtained during registration, to TElOneDriveDataStorage.ClientID and TElOneDriveDataStorage.ClientSecret properties respectively. If the app uses an external browser, it's also needed to set TElOneDriveDataStorage.RedirectURL property in case if the authorization server requests to authorize manually.
  2. Put the refresh token to TElOneDriveDataStorage.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 TElOneDriveDataStorage.HTTPClient property.
  4. Call TElOneDriveDataStorage.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 TElOneDriveDataStorage.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 OneDrive cloud

Discuss this help topic in SecureBlackbox Forum