Closed robshnup closed 1 year ago
Same response with other method to obtain a token since 6.7.25 to 6.7.30:
$auth_string = '{ "username": "'.$u.'", "password": "'.$p.'" }'; $url = SRV.'/go/api/auth.php'; $apiKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,$auth_string); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); curl_setopt($ch,CURLOPT_HTTPHEADER,array( 'Content-Type:application/json; charset=utf-8', 'Authorization:Bearer '.$apiKey, 'Content-Length:'.strlen($auth_string)) ); $res = json_decode(curl_exec($ch)); curl_close($ch); return $res->accessToken;
Response:
Exception in /home/web/go/go/core/model/Token.php at line 194: Failed to save the client identityarray ( 'platform' => array ( 'code' => 1, 'description' => 'Property is required', ), )
Is there a new method to get a token? greetings robw
Try to set a user agent on your request:
curl_setopt($ch, CURLOPT_USERAGENT, "My Awesome Client");
Hi Merijn, thanks for the hint. But unfortunately this is not the gamechanger. I'v dropped in:
curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla Firefox");
Same error as before:
Exception in /home/web/go/go/core/model/Token.php at line 194: Failed to save the client identityarray array ( 'code' => 1, 'description' => 'Property is required', ),
The raw output of the curl_exec is solely:
{"debug":[]}
Greetings
I managed to reproduce this by using Postman. It is fixed and will be rolled out in the next release
Hello you all at Intermesh, thanks for trying to fix this issue. But unfortunately with 6.7.43 I still get errors - now in another module.
[14-Aug-2023 15:26:51 UTC] Exception in /home/web/go7/go/core/orm/Property.php at line 697: Cannot set non-existing property 'remoteIpAddress' in 'go\core\model\Token'
Same approaches as mentioned above. Equal behavior with php-curl or cmdline curl Greetings robw
The token entity has no remoteIpAddress property. That property is now part of the RememberMe entity. With Postman I am not getting the error you describe. We both fire the same auth.php
script, so the output should be similar.
Could you expand further please on how to reproduce this error? You mention modules? Which ones?
Hello Joachim, OK - I call this auth.php by php-curl with this function:
$url = SRV.'/go/api/auth.php'; $auth = '{ "username": "'.$user.'", "password": "'.$pass.'" }'; function goAuth($url,$auth) { $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,$auth); curl_setopt($ch,CURLOPT_USERAGENT,"CurlClient"); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); curl_setopt($ch,CURLOPT_HTTPHEADER,array( 'Content-Type: application/json; charset=utf-8', 'Content-Length: '.strlen($auth)) ); $xml = json_decode(curl_exec($ch)); curl_close($ch); return $xml->accessToken; }
Result of this action is simple
{"debug":[]}
except the error in the php-log. No accessToken. Same result with cmdline-curl:
function goAuth($url,$auth) { $cmd = 'curl -L -k -H "Content-Type: application/json;charset=utf-8" -A "CurlClient" -X POST '.$url.' -d \''.$auth.'\''; $xml = json_decode(shell_exec($cmd)); return $xml->accessToken; }
For comparison - the xml answer with version 6.7.23 is (including the accessToken at the end):
{"version":"6.7.23","cacheClearedAt":1687488120,"accounts":{"1":{"name":"Virtual","isPrimary":true,"isReadOnly":false,"hasDataFor":[]}},"auth":{"domains":[]},"capabilities":{"maxSizeUpload":536870912,"maxConcurrentUpload":4,"maxSizeRequest":536870912,"maxConcurrentRequests":4,"maxCallInRequest":10,"maxObjectsInGet":100,"maxObjectsInSet":1000,"go:core:core":{"mayRead":true,"mayChangeUsers":true,"mayChangeGroups":true,"mayChangeCustomFields":true},"go:community:addressbook":{"mayRead":true,"mayChangeAddressbooks":false,"mayExportContacts":false},"go:community:notes":{"mayRead":true,"mayChangeNoteBooks":false},"go:legacy:calendar":{"mayRead":true,"mayManage":true},"go:legacy:email":{"mayRead":true,"mayManage":true},"go:legacy:files":{"mayRead":true,"mayManage":true,"mayAccessMainPanel":true},"go:legacy:sieve":{"mayRead":true,"mayManage":true},"go:legacy:summary":{"mayRead":true,"mayManage":true},"go:legacy:sync":{"mayRead":true,"mayManage":true},"go:community:tasks":{"mayRead":true,"mayChangeTasklists":true,"mayChangeCategories":false},"go:legacy:calendarexport":{"mayRead":true,"mayManage":true},"go:community:carddav":{"mayRead":true,"mayManage":true},"go:legacy:smime":{"mayRead":true,"mayManage":true},"go:legacy:dav":{"mayRead":true,"mayManage":true},"go:legacy:caldav":{"mayRead":true,"mayManage":true},"go:community:comments":{"mayRead":true,"mayManage":true},"go:community:apikeys":{"mayRead":true,"mayManage":true},"go:community:dev":{"mayRead":true,"mayManage":true},"go:legacy:favorites":{"mayRead":true,"mayManage":true},"go:community:notesencrypt":{"mayRead":true,"mayManage":true},"go:legacy:jitsimeet":{"mayRead":true,"mayManage":false}},"apiUrl":"https:\/\/192.168.123.200\/go\/api\/jmap.php","downloadUrl":"https:\/\/192.168.123.200\/go\/api\/download.php?blob={blobId}","pageUrl":"https:\/\/192.168.123.200\/go\/api\/page.php","uploadUrl":"https:\/\/192.168.123.200\/go\/api\/upload.php","eventSourceUrl":"https:\/\/192.168.123.200\/go\/api\/sse.php","userId":2,"state":{"addressbook-contact-detail":"o%3Acollapsed%3Db%253A0%5Ewidth%3Dn%253A591","calendar-state":"s%3A%7B%22displayType%22%3A%22month%22%2C%22days%22%3A1%2C%22calendars%22%3A%5B1%5D%2C%22view_id%22%3A0%2C%22group_id%22%3A1%7D","em-pnl-west":"o%3Acolumns%3Da%253Ao%25253Aid%25253Ds%2525253Aicon%25255Ewidth%25253Dn%2525253A35%255Eo%25253Aid%25253Ds%2525253Alabels%25255Ewidth%25253Dn%2525253A52.5%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Ds%2525253Amessage%25255Ewidth%25253Dn%2525253A258.5%255Eo%25253Aid%25253Ds%2525253Aarrival%25255Ewidth%25253Dn%2525253A87.5%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Ds%2525253Adate%25255Ewidth%25253Dn%2525253A87.5%255Eo%25253Aid%25253Ds%2525253Asize%25255Ewidth%25253Dn%2525253A70%25255Ehidden%25253Db%2525253A1%5Esort%3Do%253Afield%253Ds%25253Audate%255Edirection%253Ds%25253ADESC%5Egroup%3Ds%253Audate%5Ecollapsed%3Db%253A0","email-composer":"o%3Acollapsed%3Db%253A0%5Ewidth%3Dn%253A950%5Eheight%3Dn%253A570","email-tree-panel":"o%3Acollapsed%3Db%253A0%5Ewidth%3Dn%253A246","fav-calendar-grid":"o%3Acollapsed%3Db%253A1","go-email-west":"o%3Acollapsed%3Db%253A0%5Ewidth%3Dn%253A629","list-grid":"o%3Acolumns%3Da%253Ao%25253Aid%25253Dn%2525253A0%25255Ewidth%25253Dn%2525253A100%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A1%25255Ewidth%25253Dn%2525253A90%255Eo%25253Aid%25253Ds%2525253Alistview-calendar-name-heading%25255Ewidth%25253Dn%2525253A1081%5Esort%3Do%253Afield%253Ds%25253Astart_time%255Edirection%253Ds%25253AASC%5Egroup%3Ds%253Aday","notes-noteForm":"o%3Acollapsed%3Db%253A0%5Ewidth%3Dn%253A986%5Eheight%3Dn%253A540","select-dialog-tab":"n%3A0","task-lists-grid":"o%3Acolumns%3Da%253Ao%25253Aid%25253Ds%2525253Achecker%25255Ewidth%25253Dn%2525253A42%255Eo%25253Aid%25253Ds%2525253Aname%25255Ewidth%25253Dn%2525253A181%255Eo%25253Aid%25253Dn%2525253A2%25255Ewidth%25253Dn%2525253A35.875%255Eo%25253Aid%25253Ds%2525253Agroup%25255Ewidth%25253Dn%2525253A181%25255Ehidden%25253Db%2525253A1%5Esort%3Do%253Afield%253Ds%25253Aname%255Edirection%253Ds%25253AASC%5Egroup%3Ds%253Agroup%5Ecollapsed%3Db%253A0","tasks--task-detail":"o%3Acollapsed%3Db%253A0%5Ewidth%3Dn%253A469","tasks--tasks-grid-main":"o%3Acolumns%3Da%253Ao%25253Aid%25253Ds%2525253Acomplete%25255Ewidth%25253Dn%2525253A35%255Eo%25253Aid%25253Ds%2525253Aid%25255Ewidth%25253Dn%2525253A70%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Ds%2525253Atitle%25255Ewidth%25253Dn%2525253A93.5%255Eo%25253Aid%25253Ds%2525253Aicons%25255Ewidth%25253Dn%2525253A25%255Eo%25253Aid%25253Ds%2525253Astart%25255Ewidth%25253Dn%2525253A112%255Eo%25253Aid%25253Ds%2525253Adue%25255Ewidth%25253Dn%2525253A112%255Eo%25253Aid%25253Dn%2525253A6%25255Ewidth%25253Dn%2525253A157.5%255Eo%25253Aid%25253Ds%2525253ApercentComplete%25255Ewidth%25253Dn%2525253A131.25%255Eo%25253Aid%25253Ds%2525253Aprogress%25255Ewidth%25253Dn%2525253A131.25%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Ds%2525253AcreatedAt%25255Ewidth%25253Dn%2525253A112%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Ds%2525253AmodifiedAt%25255Ewidth%25253Dn%2525253A112%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A11%25255Ewidth%25253Dn%2525253A140%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A12%25255Ewidth%25253Dn%2525253A140%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Dn%2525253A13%25255Ewidth%25253Dn%2525253A140%25255Ehidden%25253Db%2525253A1%255Eo%25253Aid%25253Ds%2525253Acategories%25255Ewidth%25253Dn%2525253A140%25255Ehidden%25253Db%2525253A1%5Esort%3Do%253Afield%253Ds%25253Astart%255Edirection%253Ds%25253AASC%5Egroup%3Ds%253Atasklist%5Ecollapsed%3Db%253A0","tasks-status-filter":"s%3Atoday","userSettingsDialog":"o%3Acollapsed%3Db%253A0%5Ewidth%3Dn%253A1046%5Eheight%3Dn%253A607"},"CSRFToken":"64db26b76e85bab94d8ff22557890f23a813f7dc85ce6","accessToken":"64db26b76e84aeeec02312275010824ec4e0373c9
Another try with debug log says:
[2023-08-15 13:18:02][auth.php][log][go\core\Debugger:85] Method auth [2023-08-15 13:18:02][auth.php][log][go\core\Debugger:106] Method auth [2023-08-15 13:18:02][auth.php][log][go\core\auth\Authenticate:137] Auth xxxxx is local [2023-08-15 13:18:02][auth.php][log][go\core\auth\Authenticate:143] Authenticating xxxxx [2023-08-15 13:18:02][auth.php][log][go\core\auth\Authenticate:163] Trying: go\core\auth\Password [2023-08-15 13:18:02][auth.php][log][go\core\auth\Authenticate:172] success [2023-08-15 13:18:02][auth.php][error][go\core\ErrorHandler:72] Exception in /home/web/go7/go/core/orm/Property.php at line 697: Cannot set non-existing pr>[2023-08-15 13:18:02][auth.php][error][go\core\ErrorHandler:81] #0 /home/web/go7/go/core/orm/Property.php(202): go\core\orm\Property->set() [2023-08-15 13:18:02][auth.php][error][go\core\ErrorHandler:81] #1 /home/web/go7/go/core/orm/Property.php(154): go\core\orm\Property->initDatabaseColumns() [2023-08-15 13:18:02][auth.php][error][go\core\ErrorHandler:81] #2 /home/web/go7/go/core/orm/Entity.php(142): go\core\orm\Property->construct() [2023-08-15 13:18:02][auth.php][error][go\core\ErrorHandler:81] #3 /home/web/go7/api/auth.php(201): go\core\orm\Entity->__construct() [2023-08-15 13:18:02][auth.php][error][go\core\ErrorHandler:81] #4 {main}
Greetings robw
Today I've tried again with Postman 7.32.3 as described in https://groupoffice.readthedocs.io/en/latest/developer/building-a-server-module.html
With Content-type application/json
and Content-length
and my credentials I get this response:
{ "debug": [ [ "groupCollapsed", "auth" ], [ "log", "Method auth", "go\core\Debugger", 85 ], [ "groupCollapsed", "auth, time: 8ms, Peak memory usage: 0.71MB" ], [ "log", "Method auth", "go\core\Debugger", 106 ], [ "log", "Auth robw is local", "go\core\auth\Authenticate", 137 ], [ "log", "Authenticating robw", "go\core\auth\Authenticate", 143 ], [ "error", "Exception in /home/web/go7/go/core/orm/Property.php at line 697: Cannot set non-existing property 'remoteIpAddress' in 'go\core\model\Token'", "go\core\ErrorHandler", 72 ], [ "error", "#0 /home/web/go7/go/core/orm/Property.php(202): go\core\orm\Property->set()", "go\core\ErrorHandler", 81 ], [ "error", "#1 /home/web/go7/go/core/orm/Property.php(154): go\core\orm\Property->initDatabaseColumns()", "go\core\ErrorHandler", 81 ], [ "error", "#2 /home/web/go7/go/core/orm/Entity.php(142): go\core\orm\Property->construct()", "go\core\ErrorHandler", 81 ], [ "error", "#3 /home/web/go7/api/auth.php(201): go\core\orm\Entity->__construct()", "go\core\ErrorHandler", 81 ], [ "error", "#4 {main}", "go\core\ErrorHandler", 81 ], [ "groupEnd", null ] ] }
Trying with 6.7.23 it puts similar response like formerly mentioned above WITH access-token. Should I try another method to get this token? Greetings robw
Hi GO-team,
I've found out:
this fault comes, if you have only a relative URL assigned in the DB-table go_core_setting => URL
With FQ-Url everything works as expected.
Thanks for your patience & assistance.
Greetings robw
Since 6.7.25 I get this error while requesting a login-token
I use curl with code
In GO 6.7.23 this worked perfectly - in 6.7.25 not.
(.htaccess rewrite is set)
Greetings robw