useServerChallengeReceived is a custom hook that handles mTLS (Mutual TLS) authentication in Vega apps. This hook manages certificate challenges from servers and provides methods to set client certificates for secure communication.
The following shows how to import the hook.
AuthCertParams
If you need to provide authentication certificates as part of your server challenge, use theAuthCertParams interface to define them.
Properties
- url - The URL for which to set the certificates
- clientCert - Path to the client certificate file
- clientKey - Path to the client key file
Hook interface definition
The following shows the hook’s return type definition.Configuration: required assets
Network security configuration
To provide rootCA certificates, create anetwork-config.json file in your project’s assets/raw directory with the following structure.
"127.0.0.1" with your target domain and adjust includeSubdomains as needed. Setting includeSubdomains to true applies the certificate configuration to the main domain and all its subdomains (For example, both example.com and api.example.com). Set it to false to restrict the configuration to only the exact domain specified.
Certificate Files
Place the following certificate files in your application’sassets/raw directory.

