SFOAuthCoordinatorDelegate Protocol Reference

Conforms to NSObject
Declared in SFOAuthCoordinator.h

Overview

Protocol for objects intending to be a delegate for an OAuth coordinator.

Implement this protocol to receive updates from an SFOAuthCoordinator instance. Use these methods to update your interface and refresh your application once a session restarts.

– oauthCoordinator:willBeginAuthenticationWithView:

Sent when authentication will begin.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator willBeginAuthenticationWithView:(WKWebView *)view

Parameters

coordinator

The SFOAuthCoordinator instance processing this message

view

The WKWebView instance that will be used to conduct the authentication workflow

Discussion

This method supplies the delegate with the WKWebView instance, which the user will use to input their OAuth credentials during the login process. At the time this method is called the WKWebView may not yet have any content loaded, therefore the WKWebView should not be displayed until willBeginAuthenticationWithView:

Declared In

SFOAuthCoordinator.h

– oauthCoordinator:didStartLoad:

Sent when the web will starts to load its content.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator didStartLoad:(WKWebView *)view

Parameters

coordinator

The SFOAuthCoordinator instance processing this message

view

The WKWebView instance that will be used to conduct the authentication workflow

Declared In

SFOAuthCoordinator.h

– oauthCoordinator:didFinishLoad:error:

Sent when the web will completed to load its content.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator didFinishLoad:(WKWebView *)view error:(nullable NSError *)errorOrNil

Parameters

coordinator

The SFOAuthCoordinator instance processing this message

view

The WKWebView instance that will be used to conduct the authentication workflow

errorOrNil

Contains the error or nil if no error

Declared In

SFOAuthCoordinator.h

– oauthCoordinatorWillBeginAuthentication:authInfo:

Sent before oauthcoordinator will begin any kind of authentication

- (void)oauthCoordinatorWillBeginAuthentication:(SFOAuthCoordinator *)coordinator authInfo:(SFOAuthInfo *)info

Parameters

coordinator

The SFOAuthCoordinator instance processing this message

info

The SFOAuthInfo instance containing details about the type of authentication.

Declared In

SFOAuthCoordinator.h

– oauthCoordinatorDidAuthenticate:authInfo:

Sent when authentication successfully completes.

- (void)oauthCoordinatorDidAuthenticate:(SFOAuthCoordinator *)coordinator authInfo:(SFOAuthInfo *)info

Parameters

coordinator

The SFOAuthCoordinator instance processing this message.

info

Object containing info associated with this authentication attempt.

Declared In

SFOAuthCoordinator.h

– oauthCoordinator:didFailWithError:authInfo:

Sent if authentication fails due to an error.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator didFailWithError:(NSError *)error authInfo:(nullable SFOAuthInfo *)info

Parameters

coordinator

The SFOAuthCoordinator instance processing this message.

error

The error associated with the failure.

info

Object containing info associated with the authentication attempt.

Declared In

SFOAuthCoordinator.h

– oauthCoordinatorIsNetworkAvailable:

The delegate can implement this method to return a BOOL indicating whether the network is available.

- (BOOL)oauthCoordinatorIsNetworkAvailable:(SFOAuthCoordinator *)coordinator

Parameters

coordinator

The SFOAuthCoordinator object to be queried (typically self).

Declared In

SFOAuthCoordinator.h

– oauthCoordinator:willBeginBrowserAuthentication:

Sent to notify the delegate that a browser authentication flow is about to begin.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator willBeginBrowserAuthentication:(SFOAuthBrowserFlowCallbackBlock)callbackBlock

Parameters

coordinator

The SFOAuthCoordinator instance processing this message.

callbackBlock

A callback block used to notify the coordinator if it should continue with the authentication flow. Pass in YES to proceed, NO to cancel the authentication flow.

Discussion

If the delegate implements this method, it is responsible for using the callbackBlock to let the coordinator know whether it should proceed with the browser flow or not.

Declared In

SFOAuthCoordinator.h

– oauthCoordinator:displayAlertMessage:completion:

The delegate is expected to display an alert with the specific message and callback the completion block when the user dismisses the alert.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator displayAlertMessage:(NSString *)message completion:(dispatch_block_t)completion

Parameters

coordinator

The SFOAuthCoordinator instance

message

The message to display

completion

The completion block to invoke

Declared In

SFOAuthCoordinator.h

– oauthCoordinator:displayConfirmationMessage:completion:

The delegate is expected to display a confirmation alert with the specific message and callback the completion block when the user dismisses the alert.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator displayConfirmationMessage:(NSString *)message completion:(void ( ^ ) ( BOOL result ))completion

Parameters

coordinator

The SFOAuthCoordinator instance

message

The message to display

completion

The completion block to invoke with YES as result if the user confirmed the alert or NO if the user cancelled the alert.

Declared In

SFOAuthCoordinator.h

– oauthCoordinatorDidFetchAuthCode:authInfo:

Sent to notify the delegate that a authentication code was retrieved during idp flow.

- (void)oauthCoordinatorDidFetchAuthCode:(SFOAuthCoordinator *)coordinator authInfo:(SFOAuthInfo *)authInfo

Parameters

coordinator

The SFOAuthCoordinator instance processing this message.

Declared In

SFOAuthCoordinator.h

– oauthCoordinator:didBeginAuthenticationWithView: required method

Sent after authentication has begun and the view parameter is displaying the first page of authentication content.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator didBeginAuthenticationWithView:(WKWebView *)view

Parameters

coordinator

The SFOAuthCoordinator instance processing this message

view

The WKWebView instance that will be used to conduct the authentication workflow

Discussion

The delegate will receive this message when the first page of the authentication flow is visible in the view parameter. The receiver should display the view in the implementation of this method.

Warning: the view parameter must be added to a superview upon completion of this method or an assert will fail

Declared In

SFOAuthCoordinator.h

– oauthCoordinator:didBeginAuthenticationWithSession: required method

Sent after ASWebAuthenticationSession was initialized with authentication URL.

- (void)oauthCoordinator:(SFOAuthCoordinator *)coordinator didBeginAuthenticationWithSession:(ASWebAuthenticationSession *)session

Parameters

coordinator

The SFOAuthCoordinator instance processing this message

session

The ASWebAuthenticationSession instance that will be used to conduct the authentication workflow

Declared In

SFOAuthCoordinator.h

– oauthCoordinatorDidBeginNativeAuthentication: required method

Sent to notify the delegate that authentication via native REST APIs has begun.

- (void)oauthCoordinatorDidBeginNativeAuthentication:(SFOAuthCoordinator *)coordinator

Parameters

coordinator

The SFOAuthCoordinator instance processing this message

Declared In

SFOAuthCoordinator.h

– oauthCoordinatorDidCancelBrowserAuthentication: required method

Sent to notify the delegate that a browser authentication flow was cancelled out of by the user.

- (void)oauthCoordinatorDidCancelBrowserAuthentication:(SFOAuthCoordinator *)coordinator

Parameters

coordinator

The SFOAuthCoordinator instance processing this message.

Declared In

SFOAuthCoordinator.h