Login

Learn about logging on to Reltio Data Science when using the Reltio Data Science Spark SDK.

To use the Reltio Data Science Spark SDK you must first log on to Reltio Data Science. You can do so using the following code:

Note: Ensure to get the refresh token first and then log on to the Analytics framework.
import java.net._
import java.io._
import scala.io._
import scala.util.parsing.json._
var refresh_token = "c177da6b-2919-4b74-b974-e950d46ddcb2"
val url = new URL(s"$auth_url?refresh_token=$refresh_token&grant_type=refresh_token")
val urlConn = url.openConnection
urlConn.setDoInput(true)
urlConn.setDoOutput(true)
urlConn.setUseCaches(false)
urlConn.setRequestProperty("Authorization", "Basic cmVsdGlvX3VpOm1ha2l0YQ==")
val out = new OutputStreamWriter(urlConn.getOutputStream )
out.flush
out.close
val in = urlConn.getInputStream()
val result = Source.fromInputStream( in ).mkString("")
println(result)
val res_json = JSON.parseFull(result)
val map:Map[String,Any] = res_json.get.asInstanceOf[Map[String, Any]]
var access_token = map.get("access_token").get.asInstanceOf[String]
in.close
val af_framework = AnalyticsFramework.login(sqlContext, af_url, tenant, access_token)