IAMClientSDK.getInstance(this).init(scopes)
IAMClientSDK.getInstance(this).handleRedirection(this)
val sdk = IAMClientSDK.getInstance(applicationContext)
if (!sdk.isUserSignedIn) {
sdk.presentLoginScreen(this, object : IAMTokenCallback {
override fun onTokenFetchInitiated() {
}
override fun onTokenFetchComplete(zohoToken: IAMToken) {
//<This method will be called after user logged-in successfully>
}
override fun onTokenFetchFailed(zohoErrorCodes: IAMErrorCodes) {
//<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 suspendCoroutine { continuation ->
IAMClientSDK.getInstance(context).getToken(object : IAMTokenCallback {
override fun onTokenFetchInitiated() {
}
override fun onTokenFetchComplete(token: IAMToken) {
continuation.resumeWith(Result.success(token.token))
}
override fun onTokenFetchFailed(errorCode: IAMErrorCodes) {
continuation.resumeWith(Result.success(null))
}
})
}
}
override fun getInitialScopes(context: Context): String {
return ""
}
override fun isUserSignedIn(): Boolean {
return IAMClientSDK.getInstance(context).isUserSignedIn
}
override fun getUserData(): Any? {
return null
}
override fun getTransformedUrl(url: String): String {
return url
}
override fun checkAndLogout(): Boolean {
return false
}
override fun isEnhanceTokenNeeded(newScopes: String): Boolean {
return false
}
override fun enhanceToken(tokenHelper: ZCOauthHelper.ZCOAuthTokenHelper, newScopes: String) {
}
}
ZCAPIUtil.setOAuthHelper(ZCAuthImpl(applicationContext))
ZCAPIUtil.initialize(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.
You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.