ZohoSDK.getInstance(this).init(scopes, showlogs)
ZohoSDK.getInstance(this).handleRedirection(this);
val sdk = ZohoSDK.getInstance(applicationContext) if (!sdk.isUserSignedIn) { sdk.presentLoginScreen(this, object : ZohoTokenCallback { override fun onTokenFetchInitiated() { } override fun onTokenFetchComplete(zohoToken: ZohoToken?) { // This method will be called after user logged-in successfully } override fun onTokenFetchFailed(zohoErrorCodes: ZohoErrorCodes?) { // This method will be called if any error occurred in the login. You will receive the error code in this callback. } }, null) } else { // Start intent to your first activity }
class ZCAuthImpl(private val context: Context) : ZCOauthHelper {
@Throws(ZCException::class)
override suspend fun getAccessToken(): String? {
return ZohoSDK.getInstance(context).token.token
}
override fun isUserSignedIn(): Boolean {
return ZohoSDK.getInstance(context).isUserSignedIn
}
override fun getUserData(): Any? {
return null
}
override fun getTransformedUrl(url: String): String {
return url
}
override fun checkAndLogout(): Boolean {
return ZohoSDK.getInstance(context).checkAndLogout()
}
override fun isEnhanceTokenNeeded(scope: String): Boolean {
return false
}
override fun enhanceToken(tokenHelper: ZCOauthHelper.ZCOAuthTokenHelper) {
}
}
ZCAPIUtil.setOAuthHelper(ZCAuthImpl(applicationContext))
Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.
If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.
Write to us: support@zohoforms.com