createPublicClientApplication static method

Future<PublicClientApplication> createPublicClientApplication(
  1. String clientId, {
  2. String? authority,
  3. String? redirectUri,
  4. String? androidRedirectUri,
  5. String? iosRedirectUri,
  6. String? keychain,
  7. bool? privateSession,
})

@param clientId The id of the client, as registered in Azure AD @param authority The authority to authenticate against @param redirectUri The redirect uri registered for your application for all platforms @param androidRedirectUri Override for android specific redirectUri @param iosRedirectUri Override for iOS specific redirectUri @param privateSession is set to true to request that the browser doesn’t share cookies or other browsing data between the authentication session and the user’s normal browser session. Whether the request is honored depends on the user’s default web browser. Safari always honors the request. The value of this property is false by default. @param keychain this is only used in ios it won't affect android configuration for more info go to https://docs.microsoft.com/en-us/azure/active-directory/develop/single-sign-on-macos-ios#silent-sso-between-apps

Implementation

static Future<PublicClientApplication> createPublicClientApplication(
    String clientId,
    {String? authority,
    String? redirectUri,
    String? androidRedirectUri,
    String? iosRedirectUri,
    String? keychain,
    bool? privateSession}) async {
  //set the correct redirect uri based on platform
  if (Platform.isAndroid && androidRedirectUri != null) {
    redirectUri = androidRedirectUri;
  } else if (Platform.isIOS && iosRedirectUri != null) {
    redirectUri = iosRedirectUri;
  }

  var res = PublicClientApplication._create(clientId,
      authority: authority,
      redirectUri: redirectUri,
      keychain: keychain,
      privateSession: privateSession);
  await res._initialize();
  return res;
}