Closed krakazyabra closed 1 year ago
Unable to reproduce.
~$ curl -X POST http://ncadmin:ncadminpass@INT.XXX/ocs/v1.php/cloud/users -d userid="frank" -d password="frankpasswordXXX" -H "OCS-APIRequest: true"
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message>OK</message>
<totalitems></totalitems>
<itemsperpage></itemsperpage>
</meta>
<data>
<id>frank</id>
</data>
</ocs>
~$ curl -X POST http://ncadmin:ncadminpass@INT.XXX/ocs/v1.php/cloud/groups -d groupid="newgroup" -H "OCS-APIRequest: true"
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message>OK</message>
<totalitems></totalitems>
<itemsperpage></itemsperpage>
</meta>
<data/>
</ocs>
~$ curl -X POST http://ncadmin:ncadminpass@INT.XXX/ocs/v1.php/cloud/users/frank/groups -d groupid="newgroup" -H "OCS-APIRequest: true"
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message>OK</message>
<totalitems></totalitems>
<itemsperpage></itemsperpage>
</meta>
<data/>
</ocs>
(logged in to UI and confired that user frank
now exists and is a member of newgroup
)
Maybe it has something to do with your use of Social Login
'social_login_auto_redirect' => true
noredir=1
to login as a local admin. I have zero idea what implications that has for API requestsHi @joshtrichards I see that you use 3 requests: create user, create group, assign this group to user
But documentation (and in previous versions) says that there can be 2 requests only: create user, assign new group to user (under second requests there expects 2 action: create group, assign it to user). Also that was working before (I was using 22nd version)
I also was able to create group and assign it to user (create user, create group, assign group to user)
Seems, that in new version you have to create new group in advance.
What documentation says that? NC22 docs are here still: https://docs.nextcloud.com/server/22/admin_manual/configuration_user/instruction_set_for_users.html#add-user-to-group
And if I try to add a user to a group that doesn't exist I receive the expected 102
(group does not exist).
So none of that explains the token error message you reported. :-)
may be I've misunderstood and tried to assign non-existing group to existing user. But you can see in log that there is error about token :) Logs say nothing about group
Okay I looked at this again and the "Token is too short for generated token" message is normal. It's only showing up because you have your loglevel
set to 0
. You can safely ignore it (or set your loglevel to something more conventional like 2
and it'll disappear).
What I'm unclear about: Are you now able to "Make User Frank a member of group new group" successfully by calling the API as documented? (And like in my example).
Hi! Yes, now it is clear. User was created, group was created, group was assigned to user.
After updating Nextcloud to the latest version several users have reported the same issue. See here:
I have my config.php log level set at 2, but still get these errors.
Yes, since yesterday's automatic update to 27.1.3
, I see about 25 logs of this sort, server for 3 people.
[Update]
A few more days and my logs are flooded with these entries every single day.
Same here with 27.1.3
I am trying to connect Moodle to Nextcloud to use the repos. With an older version 25.0.13
it works fine, but not with 27.1.3
, where I also get this message:
OC\Authentication\Exceptions\InvalidTokenException: Token is too short for a generated token, should be the password during basic auth
and
OC\Authentication\Exceptions\InvalidTokenException: Token does not exist: token does not exist
I am seeing these errors in my logs even with log level set to 2:
Seems to happen periodically. Unsure what to do about it.
The advice I've seen is to increase your log level to 3 in the config.php. I would also like to resolve the warning.
⚠️ This issue respects the following points: ⚠️
Bug description
Get error
during API call
full error (debug)
```json { "reqId":"3oiQeu62mqcKZhIUB3g8", "level":0, "time":"2023-06-06T15:52:12+02:00", "remoteAddr":"10.31.1.173", "user":"--", "app":"no app in context", "method":"POST", "url":"/ocs/v1.php/cloud/users/Frank/groups", "message":"Token is not valid: Token is too short for a generated token, should be the password during basic auth", "userAgent":"curl/7.86.0", "version":"26.0.2.1", "exception":{ "Exception":"OC\\Authentication\\Exceptions\\InvalidTokenException", "Message":"Token is too short for a generated token, should be the password during basic auth", "Code":0, "Trace":[ { "file":"/var/www/nextcloud/lib/private/Authentication/Token/Manager.php", "line":132, "function":"getToken", "class":"OC\\Authentication\\Token\\PublicKeyTokenProvider", "type":"->", "args":[ "*** sensitive parameters replaced ***" ] }, { "file":"/var/www/nextcloud/lib/private/User/Session.php", "line":528, "function":"getToken", "class":"OC\\Authentication\\Token\\Manager", "type":"->", "args":[ "*** sensitive parameters replaced ***" ] }, { "file":"/var/www/nextcloud/lib/private/User/Session.php", "line":438, "function":"isTokenPassword", "class":"OC\\User\\Session", "type":"->", "args":[ "*** sensitive parameters replaced ***" ] }, { "file":"/var/www/nextcloud/lib/private/User/Session.php", "line":580, "function":"logClientIn", "class":"OC\\User\\Session", "type":"->", "args":[ "*** sensitive parameters replaced ***" ] }, { "file":"/var/www/nextcloud/lib/base.php", "line":1137, "function":"tryBasicAuthLogin", "class":"OC\\User\\Session", "type":"->" }, { "file":"/var/www/nextcloud/ocs/v1.php", "line":61, "function":"handleLogin", "class":"OC", "type":"::" } ], "File":"/var/www/nextcloud/lib/private/Authentication/Token/PublicKeyTokenProvider.php", "Line":155, "message":"Token is not valid: Token is too short for a generated token, should be the password during basic auth", "exception":{ }, "CustomMessage":"Token is not valid: Token is too short for a generated token, should be the password during basic auth" } } ```
Login and password are valid. Also tried to create app password and use it - same result. Seems, application expects some token, but I'm using plain password. To prepare requests I used official documentation https://docs.nextcloud.com/server/latest/admin_manual/configuration_user/user_provisioning_api.html
Steps to reproduce
Expected behavior
User Frank is now member on group "new group" API request returns 200 code and message OK
Installation method
Community Manual installation with Archive
Nextcloud Server version
26
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Nginx
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response