SessionDelegate

@objc(SBDSessionDelegate)
public protocol SessionDelegate

Represents a delegate to receive session relates events

  • App needs to fetch a new token.

    Pass on the new (retrieved) token to SDK via success(NEW_TOKEN) or fail() if fetch failed. In case when app decides not to refresh the session for this user, they should call success(nil).

    Since

    3.0.205

    Declaration

    Swift

    func sessionTokenDidRequire(
        successCompletion success: @escaping (String?) -> Void,
        failCompletion fail: @escaping () -> Void
    )

    Parameters

    success

    Call this block method after retrieving a new token. In case when app decides not to refresh the session for this user, they should call this with nil.

    fail

    Call this block method when failed to retrieve a new token.

  • Called when the SDK can’t refresh the session.

    App should force a user to a login page to connect again.

    Since

    3.0.205

    Declaration

    Swift

    func sessionWasClosed()
  • Called when SDK refreshed the session key.

    Since

    3.0.205

    Declaration

    Swift

    @objc
    optional func sessionWasRefreshed()
  • Called when the SDK run into an error while refreshing the session key.

    Since

    3.0.205

    Declaration

    Swift

    @objc
    optional func sessionDidHaveError(_ error: SBError)

    Parameters

    error

    Error object