Starting in Mobile SDK 12.0, apps built for Experience Cloud users can use a fully customizable login UI with native login. The app supplies a custom-designed login UI, and Mobile SDK displays it at the appropriate point in the login flow. There are no restrictions on how you can customize the login UI.
PKCE is a requirement for native login on Experience Cloud. See PKCE in Salesforce Help.
Also, IDP flows aren’t available for users who authenticated using native login.
Note
Preliminary Setup
Before you configure native login on Mobile SDK, complete these steps.
Configure a connected app for the authorization code and credentials flow.
For the connected app’s callback URL, enter https://{your_Experience_Cloud_site_domain}/services/oauth2/echo.
Set Up Native Login on iOS
To enable native login on iOS, add this code to your AppDelegate. Or, the app can call the same function from SceneDelegate, which provides a scene that enables multi-window support.
Customize Native Login on iOS
To authenticate a user with username and password, call this code in your custom UI.
To fall back on the webview for authentication, call this code in your custom UI.
To generate a sample application with a native login screen written in SwiftUI, use the forceios command-line tool to run this command.