正解:B
Explanation
The authentication is achieved by handling it in the code. A Named Credential is a type of metadata that specifies the URL of a callout endpoint and its required authentication parameters. An Apex callout is a way to invoke an external web service or API from Apex code. When using a Named Credential with an Apex callout, the authentication is handled by the Apex code that invokes the callout. The Apex code can use the HttpRequest class to set the endpoint, method, headers, and body of the callout request, and use the Http class to send the request and receive the response. The Apex code can also use the NamedCredential class to access the properties of the Named Credential, such as the principal type, protocol, and credential type. Handling authentication with login flows is not a valid option because login flows are a way to customize the user login process in Salesforce, not for external web services or APIs. Connecting via Salesforce Connect or Communities is not a valid option because they are not related to Apex callouts or Named Credentials.