MSALWebviewParameters

Objective-C

@interface MSALWebviewParameters : NSObject <NSCopying>

Swift

class MSALWebviewParameters : NSObject, NSCopying

User Interface configuration that MSAL uses when getting a token interactively or authorizing an end user.

Configuration options

  • The view controller to present from. If nil is provided, or if the view controller’s view is not attached to a window (i.e., parentViewController.view.window is nil), MSAL will return an error and will not proceed with authentication. A valid parentViewController with its view attached to a valid window is required to proceed with authentication.

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) MSALViewController *parentViewController;

    Swift

    var parentViewController: UIViewController { get set }
  • Modal presentation style for displaying authentication web content. Note that presentationStyle has no effect when webviewType == MSALWebviewType.MSALWebviewTypeDefault or webviewType == MSALWebviewType.MSALWebviewTypeAuthenticationSession.

    Declaration

    Objective-C

    @property (nonatomic) UIModalPresentationStyle presentationStyle;

    Swift

    var presentationStyle: UIModalPresentationStyle { get set }
  • A Boolean value that indicates whether the ASWebAuthenticationSession should ask the browser for a private authentication session. The value of this property is false by default. For more info see here: https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio?language=objc

    Declaration

    Objective-C

    @property (nonatomic) BOOL prefersEphemeralWebBrowserSession;

    Swift

    var prefersEphemeralWebBrowserSession: Bool { get set }
  • A specific webView type for the interactive authentication flow. By default, it will be set to MSALGlobalConfig.defaultWebviewType.

    Declaration

    Objective-C

    @property (nonatomic) MSALWebviewType webviewType;

    Swift

    var webviewType: Int32 { get set }
  • For a webviewType MSALWebviewTypeWKWebView, custom WKWebView can be passed on. Web content will be rendered onto this view. Observe strings declared in MSALPublicClientStatusNotifications to know when to dismiss.

    Declaration

    Objective-C

    @property (nonatomic, nullable) WKWebView *customWebview;

    Swift

    var customWebview: WKWebView? { get set }

Constructing MSALWebviewParameters

  • Creates an instance of MSALWebviewParameters with the provided parentViewController.

    Note

    parentViewController is mandatory on iOS 13+ and macOS 10.15+. If nil is provided, or if the view controller’s view is not attached to a window (i.e., parentViewController.view.window is nil), MSAL will return an error and authentication will not proceed. A valid parentViewController with its view attached to a valid window is required to proceed with authentication.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAuthPresentationViewController:
        (nonnull MSALViewController *)parentViewController;

    Swift

    init(authPresentationViewController parentViewController: UIViewController)

    Parameters

    parentViewController

    The view controller to present authorization UI from.

  • It is recommended to use the default webview configuration setting provided by a public MSAL API. ex: WKWebViewConfiguration *defaultWKWebConfig = [MSALWebviewParameters defaultWKWebviewConfiguration]; WKWebView *embeddedWebview = [[WKWebView alloc] initWithFrame:yourWebview.frame configuration:defaultWKWebConfig];

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) WKWebViewConfiguration *_Nonnull defaultWKWebviewConfiguration;

    Swift

    class var defaultWKWebviewConfiguration: WKWebViewConfiguration { get }

Unavailable initializers

  • Unavailable

    Note

    Use [MSALWebviewParameters initWithAuthPresentationViewController:] instead

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Unavailable

    Note

    Use [MSALWebviewParameters initWithAuthPresentationViewController:] instead

    Declaration

    Objective-C

    + (nonnull instancetype)new;