[Bug]: Error on LoginFlowV2Service while authenticating from app token
⚠️ This issue respects the following points: ⚠️
- [X] This is a bug, not a question or a configuration/webserver/proxy issue.
- [X] This issue is not already reported on Github (I've searched it).
- [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- [X] I agree to follow Nextcloud's Code of Conduct.
Bug description
I'm getting this error when I tried to authenticate the AntennaPod android app using an app-token to sync with gpodder-nextcloud.
Issue on AntennaPod's side was also created
Steps to reproduce
- On AntennaPod choose sync service as GpodderSync
- Put nextcloud server address and browser shows login screen
- Choose to login with app token
- Put credentials
Expected behavior
Normal authentication
Installation method
No response
Operating system
No response
PHP engine version
No response
Web server
No response
Database engine version
No response
Is this bug present after an update or on a fresh install?
No response
Are you using the Nextcloud Server Encryption module?
No response
What user-backends are you using?
- [ ] Default user-backend (database)
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
Configuration report
No response
List of activated Apps
Enabled:
- accessibility: 1.10.0
- activity: 2.16.0
- calendar: 3.4.1
- circles: 24.0.0
- cloud_federation_api: 1.7.0
- comments: 1.14.0
- contacts: 4.1.1
- contactsinteraction: 1.5.0
- dashboard: 7.4.0
- dav: 1.22.0
- federatedfilesharing: 1.14.0
- federation: 1.14.0
- files: 1.19.0
- files_pdfviewer: 2.5.0
- files_rightclick: 1.3.0
- files_sharing: 1.16.2
- files_trashbin: 1.14.0
- files_versions: 1.17.0
- files_videoplayer: 1.13.0
- firstrunwizard: 2.13.0
- gpoddersync: 3.4.0
- logreader: 2.9.0
- lookup_server_connector: 1.12.0
- news: 18.1.0
- nextcloud_announcements: 1.13.0
- notes: 4.3.1
- notifications: 2.12.0
- oauth2: 1.12.0
- password_policy: 1.14.0
- phonetrack: 0.7.0
- photos: 1.6.0
- privacy: 1.8.0
- provisioning_api: 1.14.0
- recommendations: 1.3.0
- serverinfo: 1.14.0
- settings: 1.6.0
- sharebymail: 1.14.0
- support: 1.7.0
- survey_client: 1.12.0
- systemtags: 1.14.0
- tasks: 0.14.4
- text: 3.5.1
- theming: 1.15.0
- twofactor_backupcodes: 1.13.0
- twofactor_totp: 6.4.0
- updatenotification: 1.14.0
- user_status: 1.4.0
- viewer: 1.8.0
- weather_status: 1.4.0
- workflowengine: 2.6.0
Disabled:
- admin_audit
- encryption
- files_external
- user_ldap
Nextcloud Signing status
No response
Nextcloud Logs
Exception: Argument 3 passed to OC\Core\Service\LoginFlowV2Service::flowDoneWithAppPassword() must be of the type string, null given, called in /config/www/nextcloud/core/Controller/ClientFlowLoginV2Controller.php on line 227 in file '/config/www/nextcloud/core/Service/LoginFlowV2Service.php' line 189
/config/www/nextcloud/lib/private/AppFramework/App.php - line 172:
OC\AppFramework\Http\Dispatcher->dispatch()
/config/www/nextcloud/lib/private/Route/Router.php - line 298:
OC\AppFramework\App::main()
/config/www/nextcloud/lib/base.php - line 1023:
OC\Route\Router->match()
/config/www/nextcloud/index.php - line 36:
OC::handleRequest()
Causado por TypeError: Argument 3 passed to OC\Core\Service\LoginFlowV2Service::flowDoneWithAppPassword() must be of the type string, null given, called in /config/www/nextcloud/core/Controller/ClientFlowLoginV2Controller.php on line 227
/config/www/nextcloud/core/Controller/ClientFlowLoginV2Controller.php - line 227:
OC\Core\Service\LoginFlowV2Service->flowDoneWithAppPassword()
/config/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 225:
OC\Core\Controller\ClientFlowLoginV2Controller->apptokenRedirect()
/config/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 133:
OC\AppFramework\Http\Dispatcher->executeController()
/config/www/nextcloud/lib/private/AppFramework/App.php - line 172:
OC\AppFramework\Http\Dispatcher->dispatch()
/config/www/nextcloud/lib/private/Route/Router.php - line 298:
OC\AppFramework\App::main()
/config/www/nextcloud/lib/base.php - line 1023:
OC\Route\Router->match()
/config/www/nextcloud/index.php - line 36:
OC::handleRequest()
Additional info
No response
Hi @aleprovencio :wave:
Thanks for your bug report. I can confirm that authenticate with app password is broken.
https://github.com/nextcloud/server/blob/f41c45878fd3800a355da4dbcbeba8133f418326/core/Controller/ClientFlowLoginV2Controller.php#L219
$this->userId is null when the current user is not logged in and tries to use an app password.
Index: core/Controller/ClientFlowLoginV2Controller.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php
--- a/core/Controller/ClientFlowLoginV2Controller.php (revision 6b61ae235efea7e78f61e481696f124d9be71b5f)
+++ b/core/Controller/ClientFlowLoginV2Controller.php (date 1657390413663)
@@ -224,7 +224,7 @@
return $response;
}
- $result = $this->loginFlowV2Service->flowDoneWithAppPassword($loginToken, $this->getServerPath(), $this->userId, $password);
+ $result = $this->loginFlowV2Service->flowDoneWithAppPassword($loginToken, $this->getServerPath(), $token->getLoginName(), $password);
return $this->handleFlowDone($result);
}
Make it work for me. However I don't know if that's a proper fix here.
cc @juliushaertl @nextcloud/server-backend
Change makes sense to me 👍
Change makes sense to me +1
seconded
I have the same problem accessing Nextcloud 24.0.4 at openSuSe Leap 15.4 with Nextcloud Client (AppImage) 3.5.4. The one line patch from kesselb above fixed my problem. (there should come a official fix)
Same bug and working fix for me.
@kesselb could you simply open a PR? If it's not a proper fix then it can be refused there.
Upgrading from 24.0.9 to 25.0.3 fixed this issue in my installation, thx!