Tip: Hide that annoying iOS privacy prompt

Do your users get annoyed by the privacy prompt in iOS (13+) during logon?

iOS Privacy Prompt

The prompt is meant to let users know that they are being tracked using cookies. However, it can be annoying to the users. There is a way to hide it.

If you are developing on native iOS platform, it can be hidden by settings “prefersEphemeralWebBrowserSession” to true on browser before calling start method.

MSAL.NET provides a way to hide the prompt in version 4.31. SystemWebViewOptions has a new property iOSHidePrivacyPrompt. By default, this property is false. When the property is set to true and the options is added to PublicClientApplicationBuilder, it will hide the prompt.

e.g.

// Hide the privacy prompt
SystemWebViewOptions systemWebViewOptions = new SystemWebViewOptions()
                                                                                           { 
                                                                                               iOSHidePrivacyPrompt = true,
                                                                                           };

var authResult = await App.PCA.AcquireTokenInteractive(App.Scopes)
                                                   .WithParentActivityOrWindow(App.ParentWindow)
                                                   .WithSystemWebViewOptions(systemWebViewOptions)
                                                   .ExecuteAsync();

This can be added to the common code across the platforms as it ignores the platforms where it is not applicable. Updated sample can be seen here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s