Authenticated consent allows your organization to tie an end-users consent preferences to a unique end-user identifier that will persist across authenticated (i.e. logged-in) devices. In this article, we will cover how to enable authenticated consent for:
​Web​
​iOS devices​
​Android devices​
​Webview​
The following requirements must be met In order to successfully utilize authenticated consent between web and app properties:
Properties using authenticated consent must use the same vendor list
The consent scope for the vendor list should be set to Shared site (see below)
To implement authenticated consent on a web page, you can write a cookie directly on the page to pass the consent identifier to Sourcepoint.
document.cookie = "authId=123123123";
To implement authenticated consent on iOS devices, the authId
should be passed as a parameter when the .loadMessage()
function is initially called in our first class SDK for iOS.
//Example for SwiftconsentViewController.loadMessage(forAuthId: "JohnDoe")
//Example for Objective-C[consentViewController loadMessage for AuthId: @"JohnDoe"]
To implement authenticated consent on android devices, you will need to use the .setauthId
(string) function in the context of the consentLib
object when you run a new build.
//Example only. Your parameters should correspond to your propertyConsentLib.newBuilder(22, "mobile.demo", 2323, "6d1f92c8d85c4d41d7963412",this)//calling other .set methods.setAuthId("JohnDoe").build();
The SDK will bring the consent data from the server, overwriting whatever was stored in the device.
To implement authenticated consent for webviews, create a cookie with the authId
as content before the CMP javascript tag is loaded. This can either be done within the webview, or it can also be set when initializing the webview from the native app.
Your organization will need to integrate the CMP javascript tags within your webview prior to enabling authenticated consent.
//iOS examplelet cookie = HTTPCookie(properties: [.domain: "mobile.demo.com",.path: "/",.name: "authId",.value: "JohnDoe",.seucre: "TRUE:,.expires: NSDate(timeIntervalSinceNow: 42667037)])!​webView.configuration.websiteDataStore.httpCookieStore.setCookie(cookie)
//Android exampleprivate fun setCookie(){val webView = WebView(this) //this = contextval cookieManager = CookieManager.getInstance()cookieManager.acceptCookie()val domain = "https://mobile.demo.com/"webView.webViewClient = WebViewClient()webView.settings.javaScriptEnabled = true$cookieKey = "authId";$cookieValue = "JohnDoe"cookieManager.setCookie(domain,"$cookieKey=$cookieValue")cookieManager.setAcceptThirdPartyCookies(webView, true)webView.loadUrl(domain)}