Discuss this help topic in SecureBlackbox Forum

Clouds: Authenticate on Box 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 TElBoxDataStorage.ClientID and TElBoxDataStorage.ClientSecret properties respectively.
  2. Put the refresh token to TElBoxDataStorage.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 TElBoxDataStorage.HTTPClient property.
  4. Call TElBoxDataStorage.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 TElBoxDataStorage.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 Box.com cloud

Discuss this help topic in SecureBlackbox Forum