Hello,
I'm trying to have API working inside my symfony project.
I've been struggling a bit but now I'm able to display current user - this is the first step.
My question is about auth.
For now what I did is :
- Generate self-authorized grant and refresh token from developerconsole
- Copy grant token for backup
- I generated refresh token by making a POST request with the URL below
- I copied the values of these tokens inside variables (as well as for my client_id, client_secret, etc) and I inserted those variables inside the configuration array like this :
$configuration=array(
'client_id' => $client_id,
'client_secret' => $client_secret,
'redirect_uri' => $redirect_uri,
'currentUserEmail' => $current_user_email,
'persistence_handler_class' => 'ZohoOAuthPersistenceHandler',
'db_name' => 'subsman',
'db_username' => 'root',
'db_password' => 'HiTdwXFvd3g%PW',
);
- And then I ran this :
ZCRMRestClient::initialize($configuration);
$oAuthClient = \zcrmsdk\oauth\ZohoOAuth::getClientInstance();
$userIdentifier = $current_user_email;
$oAuthTokens = $oAuthClient->generateAccessTokenFromRefreshToken($refreshToken,$userIdentifier);
All of this is inside the constructor of the class RestC.
So it gets executed when I do this :
And then I intend to call some method to display current user or other stuff, like this :
My question is : do I have to call the method generateAccessTokenFromRefreshToken each time ?
Other question : now the refresh token is inside the code as a string, but it's also stored inside the database.
So do I have to keep it as a string or can i just retrieve it from db ?
Thanks for your help.