Proxying SDK Network Calls
Overview
Various regulations require apps provided by network providers to not consume data. Companies have previously managed this by whitelisting specific URLs which prevents the use of end user data while using the app. However, one big limitation is that only specific domains or subdomains can be whitelisted, not paths. Since the OneTrust SDK makes calls to various endpoints to fetch data, there was no way to override these to custom domains.
To address this limitation, the SDK now provides for the ability to override the URLs it uses. This allows customers to proxy the network calls made from the OneTrust SDK when performing the following actions:
- Download OneTrust SDK data
- Download logos (e.g., Banner, Preference Center, App Tracking Transparency, Age Gate)
- Download vendor lists (General, Google, and IAB)
- Log consent receipts
In addition to regulatory compliance, this feature is also useful for companies that have security restrictions regarding third party network calls and internal apps that can't reach networks outside of the corporate intranet.
Setting up the proxy on Android
-
Implement the interface
OTProxyManager
in your activity or application class. -
Create a function
getProxyDomain()
and set the URLs you'd like to override to for each type. You can check for different proxy types available inOTProxyType
.public URL getProxyDomain(@NonNull OTProxyType type) { // Here are the different URLs which can be overriden. Remove the condition if a case does not apply try { if (type instanceof OTProxyType.SDKDataDownload) { // insert the SDK data endpoint to be overriden to. return new URL("https://customdataendpoint.com"); } else if (type instanceof OTProxyType.LogConsent) { // insert the Consent Logging endpoint to be overriden to. return new URL("https://customreceiptsendpoint.com"); } else if (type instanceof OTProxyType.IABVendors) { // insert the IAB Vendors endpoint to be overriden to. return new URL("https://customiabendpoint.com"); } else if (type instanceof OTProxyType.GoogleVendors) { // insert the Google Vendors endpoint to be overriden to. return new URL("https://customvendorsendpoint.com"); } else if (type instanceof OTProxyType.BannerLogo) { // insert the Banner Logo endpoint to be overriden to. return new URL("https://custombannerlogoendpoint.com"); } else if (type instanceof OTProxyType.PCLogo) { // insert the PC Logo endpoint to be overriden to. return new URL("https://custompclogoendpoint.com"); } else if (type instanceof OTProxyType.AgeGateLogo) { // insert the AgeGate Logo endpoint to be overriden to. return new URL("https://customagegateendpoint.com"); } } catch (MalformedURLException e) { e.printStackTrace(); } return null; }
-
Set the proxy manager instance in the SDK before calling
startSDK()
.OTCustomConfigurator.setupProxyManager(this);
IMPORTANT
If an empty or null URL is passed in step 2, the SDK will default to our original endpoints to fetch data.
Updated 6 months ago