You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, a big thank you for making such a great wrapper. I haven't touched PHP in a while and this has made the process super easy.
I am however having an issue when attempting to explicitly logout from the filemaker data api after making a call.
Context
I'm only using the api to access data transactionally and don't want or need to be remain logged in. Specifically, what i'm trying to do is get a list of the clients connected to the filemaker server then delete/close the session after gathering this data.
My implementation
from the documentation/code i understand that an explicit call to delete/close the session is called via the function within the api object of apiLogout()
therefore my code reads as follows (no error handling added yet)
debugging further, within the actual fmAdminApi.class.php file, i am adding the following line within the apiLogout() function before the curl command is called:
this then reveals that the token is not being added to the url.
https://{my host}/fmi/admin/api/v2/user/auth/
then looking at fmAPI.class.php it appears that getToken() sources the admin api's "token" key.
given the above url missing the token, i assumed that the token does not exist or that key is empty which on echo of the admin api object i discovered i was correct:
(shortened version with sensitive details redacted)
it's worth noting i've worked around this by adding an explicit call to apiLogin() before my call to get the client list which resolves the issue (stores the token in the admin api object)
so perhaps its an assumption on my part that the wrapper should be saving the token if auto login occurs (when calling api without explicitly logging in)
Phillbaska
changed the title
Issues with apLogout() function
Issues with apiLogout() function
Apr 8, 2023
I'm unable to reproduce this - apiLogout() does indeed send the token. You can call apiListClients() without needing to login first as the code takes care of calling login for you (and handling the token management).
Have you looked at the debug log output to see if there's anything curious going on?
First of all, a big thank you for making such a great wrapper. I haven't touched PHP in a while and this has made the process super easy.
I am however having an issue when attempting to explicitly logout from the filemaker data api after making a call.
Context
I'm only using the api to access data transactionally and don't want or need to be remain logged in. Specifically, what i'm trying to do is get a list of the clients connected to the filemaker server then delete/close the session after gathering this data.
My implementation
from the documentation/code i understand that an explicit call to delete/close the session is called via the function within the api object of apiLogout()
therefore my code reads as follows (no error handling added yet)
$aapi = new fmAdminAPI($host, $aapi_username, $aapi_password);
$client_list = $aapi->apiListClients();
$aapi_result = $aapi->apiLogout();
however, what i am finding is that line 3 is returning an error response. When echoing the result i get:
array(2) {
["response"]=> array(0) {}
["messages"]=> array(1) { [0]=> array(2) {
["code"]=> string(4) "1704"
["text"]=> string(48) "Resource doesn't support the specified HTTP verb"
}
}
}
debugging further, within the actual fmAdminApi.class.php file, i am adding the following line within the apiLogout() function before the curl command is called:
echo '<pre>' , $this->getAPIPath(PATH_ADMIN_LOGOUT).'/'. $this->getToken() , '</pre>'
this then reveals that the token is not being added to the url.
https://{my host}/fmi/admin/api/v2/user/auth/
then looking at fmAPI.class.php it appears that getToken() sources the admin api's "token" key.
given the above url missing the token, i assumed that the token does not exist or that key is empty which on echo of the admin api object i discovered i was correct:
(shortened version with sensitive details redacted)
Object(fmAdminAPI)#1 (24) {
["cloud"]=> bool(false)
["convertBooleanStrings"]=> bool(true)
["userName"]=> NULL
["password"]=> NULL
["storeUNPW"]=> bool(false)
["host"]=> string(25) "https://{my host}"
["credentials"]=> string(48) "{base64StringOfPassword}"
["sendCredentialsIfNoToken"]=> bool(true)
["token"]=> string(0) ""
["tokenTimeStamp"]=> int(0)
["storeTokenInSession"]=> bool(true)
["sessionTokenKey"]=> string(22) "FM-Admin-Session-Token"
["tokenFilePath"]=> string(0) ""
Is there another setting im missing that needs to be applied to retain the token so it can be used to logout?
Thanks again
Phill
The text was updated successfully, but these errors were encountered: