Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ apiBaseUrl
apiVersion
access_type
accounts_url
persistence_handler
persistence_handler_class
token_persistence_path
db_port
Expand Down Expand Up @@ -111,7 +112,9 @@ applicationLogFilePath - The SDK stores the log information in a file.
The file path of the folder must be specified in the key and the SDK automatically creates the file. The default file name is the ZCRMClientLibrary.log.
In case the path isn't specified, the log file will be created inside the project.

persistence_handler_class is the implementation of the ZohoOAuthPersistenceInterface.
persistence_handler_class is the implementation of the ZohoOAuthPersistenceInterface. This will instantiate a class based on the file location. eg \home\php\CustomPersistence.php

persistence_handler - You can inject an instantiated persistence hander into the configuration during run time to pass yourcustom persistence handler to the XohoOAuth class.

>If the Optional keys are not specified, their default values will be assigned automatically.
>The 'apiBaseUrl' and 'accounts_url' are mandatory in case the user is not in the "com" domain.
Expand Down
7 changes: 6 additions & 1 deletion src/oauth/ZohoOAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use zcrmsdk\oauth\exception\ZohoOAuthException;
use zcrmsdk\oauth\persistence\ZohoOAuthPersistenceByFile;
use zcrmsdk\oauth\persistence\ZohoOAuthPersistenceHandler;
use zcrmsdk\oauth\persistence\ZohoOAuthPersistenceInterface;
use zcrmsdk\oauth\utility\ZohoOAuthConstants;
use zcrmsdk\oauth\utility\ZohoOAuthParams;

Expand Down Expand Up @@ -48,6 +49,7 @@ private static function setConfigValues($configuration)
ZohoOAuthConstants::CLIENT_SECRET,
ZohoOAuthConstants::REDIRECT_URL,
ZohoOAuthConstants::ACCESS_TYPE,
ZohoOAuthConstants::PERSISTENCE_HANDLER,
ZohoOAuthConstants::PERSISTENCE_HANDLER_CLASS,
ZohoOAuthConstants::IAM_URL,
ZohoOAuthConstants::TOKEN_PERSISTENCE_PATH,
Expand Down Expand Up @@ -140,6 +142,9 @@ public static function getPersistenceHandlerInstance()
if(ZohoOAuth::getConfigValue("token_persistence_path")!=""){
return new ZohoOAuthPersistenceByFile() ;
}
else if(self::$configProperties[ZohoOAuthConstants::PERSISTENCE_HANDLER] instanceof ZohoOAuthPersistenceInterface){
return self::$configProperties[ZohoOAuthConstants::PERSISTENCE_HANDLER];
}
else if(self::$configProperties[ZohoOAuthConstants::PERSISTENCE_HANDLER_CLASS] == "ZohoOAuthPersistenceHandler"){
return new ZohoOAuthPersistenceHandler();
}
Expand All @@ -161,4 +166,4 @@ public static function getClientInstance()
}
return ZohoOAuthClient::getInstanceWithOutParam();
}
}
}
4 changes: 3 additions & 1 deletion src/oauth/utility/ZohoOAuthConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class ZohoOAuthConstants

const EXPIRIY_TIME = "expiry_time";

const PERSISTENCE_HANDLER = "persistence_handler";

const PERSISTENCE_HANDLER_CLASS = "persistence_handler_class";

const PERSISTENCE_HANDLER_CLASS_NAME = "persistence_handler_class_name";
Expand Down Expand Up @@ -86,4 +88,4 @@ class ZohoOAuthConstants

const RESPONSECODE_OK = 200;

}
}