refresh_authorization


Description:

public abstract bool refresh_authorization (Cancellable? cancellable = null) throws Error

Forces the Authorizer to refresh any authorization tokens it holds with the online service.

This should typically be called when a Service query returns AUTHENTICATION_REQUIRED, and is already called transparently by methods such as query and insert_entry (see their documentation for more details).

If re-authorization is successful, it's guaranteed that by the time this method returns, the properties containing the relevant authorization tokens on the Authorizer instance will have been updated.

If false is returned, error will be set if (and only if) it's due to a refresh being attempted and failing. If a refresh is not attempted, false will be returned but error will not be set.

If the Authorizer has not been previously authenticated or authorized (using the class' specific methods), no authorization will be attempted, false will be returned immediately and error will not be set.

Some Authorizer implementations may not support refreshing authorization tokens at all; for example if doing so requires user interaction. false will be returned immediately in that case and error will not be set.

This method is thread safe.

Parameters:

this

a Authorizer

cancellable

optional Cancellable object, or null

Returns:

true if an authorization refresh was attempted and was successful, false if a refresh wasn't attempted or was unsuccessful