# AVAAuthenticationDelegate

Objective-C

    @protocol AVAAuthenticationDelegate <NSObject>

Swift

    protocol AVAAuthenticationDelegate : NSObjectProtocol

@discussion Delegate protocol for events related to authentication.

Creating a delegate is optional, and may be used to receive callbacks for important authentication events.

- `-onInvalidToken:handler:`

  @abstract Notifies the delegate that the current jwt used to authenticate requests is invalid.

  @discussion Called when a request fails due to an invalid jwt. Use `completionHandler` to update the token and automatically retry the failed request. If the updated jwt is also invalid, this method is called again, with a maximum of 5 retry attempts per request.

  #### Declaration

  Objective-C

      - (void)onInvalidToken:(nonnull NSError *)error
                     handler:
                         (nonnull AVAAuthenticationCompletionBlock)completionHandler;

  Swift

      optional func onInvalidToken(_ error: Error) async -> String

  #### Parameters

  `error` | Error object for the request
  `completionHandler` | Block to call with the updated jwt

© 2022 . All rights reserved. (Last updated: 2022-06-30)

Generated by jazzy ♪♫ v0.14.2, a Realm project.