Registering your iOS app with Zoho generates a Client ID and Client Secret combination. These are required to allow your iOS app to integrate with your Creator application. To register your iOS app with Zoho:
#import <ZohoPortalAuthKit/ZohoPortalAuth.h>
import ZCUIFramework
class
SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(
_scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if let windowScene = scene as? UIWindowScene { let window = UIWindow(windowScene: windowScene) } let scope =
["aaaserver.profile.READ","zohocontacts.userphoto.READ","ZohoContacts.contactapi.READ","ZohoCreator.meta.CREATE","ZohoCreator.meta.READ","ZohoCreator.meta.UPDATE","ZohoCreator.meta.DELETE","ZohoCreator.data.CREATE","ZohoCreator.data.READ","ZohoCreator.data.UPDATE","ZohoCreator.data.DELETE","Stratus.stratusop.READ","ZohoCRM.modules.READ","ZohoCRM.users.READ"]let clientID =
"<Your Client ID>"let clientSecret =
"<Your Client Secret>"let portalId =
"<Your Portal id>"let urlScheme =
"<Your Url Scheme>"let accountsUrl =
"https://accounts.zohoportal.com"//enter the accounts URL of your respective DC. For eg: EU users use
'https://accounts.zohoportal.eu'.ZohoPortalAuth.initWithClientID(clientID, clientSecret: clientSecret, portalID: portalId, scope: scope, urlScheme: urlScheme, mainWindow: self.window!, accountsPortalURL: accountsUrl) // To verify if the app is already logged in ZohoPortalAuth.getOauth2Token { (token, error) in if token ==
nil{ // Not logged in self.showLoginScreen() } else { // App logged in already. // Ensure to use the following line of code in your iOS app before you utilize any of Creator SDK’s methods Creator.configure(uiDelegate: self) } } } func scene(
_scene: UIScene, openURLContexts URLContexts: Set <UIOpenURLContext> ) { if let context = URLContexts.first { let _ = ZohoPortalAuth.handleURL(context.url, sourceApplication: context.options.sourceApplication, annotation: context.options.annotation) } } } extension SceneDelegate: ZCUIServiceDelegate { func oAuthToken(with completion: @escaping AccessTokenCompletion) { ZohoPortalAuth.getOauth2Token { (token, error) in completion(token, error) } } func openURL(for openURLTasks: [OpenUrlTask]) { // Get Call back here when openurl have query string "zc_MobileSDK_HandleOpenURL=true" } }
func showLoginScreen() {
ZohoPortalAuth.presentZohoPortalSign( in: { (token, error) in if token !=
nil{ //login success } }) }
func logout() { ZohoPortalAuth.revokeAccessToken { (error) in if error ==
nil{ //Logout Successfully } else { //Error Occurred } } }
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.