このヘルプページはCreator 6のユーザーを対象としています。以前のバージョン(Creator 5)を使用している場合は、こちらをクリックしてください。ご利用中のCreatorバージョンを確認してください。
iOSアプリをZohoに登録すると、クライアントIDとクライアントシークレットの組み合わせが生成されます。これらは、iOSアプリをCreatorアプリケーションと連携できるようにするために必要です。ZohoにiOSアプリを登録するには、次の手順を実行します。




#インポート <ZohoPortalAuthKit/ZohoPortalAuth.h>
インポート ZCCoreFramework
classSceneDelegate: UIResponder, UIWindowSceneDelegate {_
var window: UIWindow ?
func scene(scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {['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']
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
}
let scope ='<Your Client ID>'
let clientID ='<Your Client Secret>'
let clientSecret ='<Your Portal ID>'
let portalId ='<Your Url Scheme>'
let urlScheme ='https://accounts.zohoportal.com'
let accountsUrl =// enter the accounts URL of your respective DC. For eg: EU users must use'https://accounts.zohoportal.eu'nil
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 =={_
// 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(delegate: 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)
}
}
}
拡張機能 SceneDelegate: ZCCoreFrameworkDelegate {
func oAuthToken(with completion: @escaping AccessTokenCompletion) {
ZohoPortalAuth.getOauth2Token {
(token, error) in
completion(token, error)
}
}
}
func showLoginScreen() {nil
ZohoPortalAuth.presentZohoPortalSign( in: {
(token, error) in
if token !={
//login success
}
})
}
func logout() {nil
ZohoPortalAuth.revokeAccessToken {
(error) in
if error =={
//Logout Successfully
}
else {
//Error Occurred
}
}
}