Nyelv

ActiveDirectoryAuthenticationProvider.SetParentActivityOrWindowFunc Method

Definition

Sets a function to return the parent window handle to be used for WAM (Windows Account Manager) broker authentication prompts.

public:
 void SetParentActivityOrWindowFunc(Func<System::Object ^> ^ parentActivityOrWindowFunc);
public void SetParentActivityOrWindowFunc(Func<object>? parentActivityOrWindowFunc);
public void SetParentActivityOrWindowFunc(Func<object> parentActivityOrWindowFunc);
member this.SetParentActivityOrWindowFunc : Func<obj> -> unit
Public Sub SetParentActivityOrWindowFunc (parentActivityOrWindowFunc As Func(Of Object))

Parameters

parentActivityOrWindowFunc
Func<Object>

A function that returns the parent window/activity object to be used by MSAL for interactive authentication UI. On Windows, return an IntPtr window handle (or an IWin32Window on .NET Framework). On Android, return an Activity; on iOS, return a UIViewController (or the platform equivalent). Pass null to clear a previously installed callback and revert to the provider's default behavior.

Remarks

On Windows, this handle is used to parent the WAM broker dialog. If not set, the provider will attempt to automatically detect the console window handle. On non-Windows platforms, this callback is forwarded to MSAL so interactive flows can parent their UI to the host Activity / UIViewController (or platform equivalent).

Exceptions thrown by parentActivityOrWindowFunc when it is invoked by MSAL are not caught by the provider; they propagate up to the caller of the originating AcquireToken request so that bugs in the callback surface where they are most diagnosable.

Applies to