RefreshTokenDelegate

public protocol RefreshTokenDelegate : AnyObject

The RefreshTokenDelegate protocol defines methods that allow you to handle any 401 errors that may return from network calls.

  • Asks the refreshTokenDelegate for a new OAuth2 token

    If the DexcareSDK.refreshTokenDelegate property is set, this function will get called when a network call receives a 401 error code. The SDK will call this method, and wait for a response infinitely. It is up to you to call the tokenCallback with a nil or a valid token If this function returns a nil, the sdk will automatically revert the original request to it’s originating error and return. If a new token is set, the sdk will set it’s Authorization header with the new token and retry the request. Any subsequent 401 errors will revert back to the original error, and NOT call this method again. You may also pass through a nil string if you need to return quickly from this function.

    Declaration

    Swift

    func newTokenRequest(tokenCallback: @escaping TokenRequestCallback)

    Parameters

    tokenCallback

    A callback that sends the new token