Tim Oxendale
Forum Replies Created
-
Forum: Plugins
In reply to: [Tim's Nextcloud SSO OAuth2] nc-sso-error=returned-invalidNot a problem and thanks!
I also struggled to get any of the other SSO solutions to work hence building this, seemed selfish not to share it!
Forum: Plugins
In reply to: [Tim's Nextcloud SSO OAuth2] nc-sso-error=returned-invalidI’m just pushing an update now that I’m hoping will sort it out!
Forum: Plugins
In reply to: [Tim's Nextcloud SSO OAuth2] nc-sso-error=returned-invalidHey, sorry to hear you’re having problems.
So when the Login with … button loads it generates a string and saves it into the session, then when you click the login with … button it also passes the string to Nextcloud in the URL with the state parameter, then when Nextcloud returns you back to the site it then validates the two values to make sure it’s the same request being sent back from Nexcloud.
What is failing is the session has either been destroyed and/or the two stings no longer match.A quick way to conform that’s the only issue would be to remove the lines that check it:
if($_SESSION['state'] != $_GET['state']){ tims_nso_throw_error('returned-invalid'); }From /tims-nextcloud-sso-oauth2/includes/functions.php should be line 54 to 57.
Then if that works, that’s definitely the only issue and I’ll have a think on a way to make the state a bit more persistent and release an update.
Let me know how you get on.
I have updated the plugin to be compatible with older versions of Nextcloud, and thanks for the review!
Hey, replace the plugin with this one: https://www.filemail.com/d/zowkrpysvxndhqb and enable debug again and try to login, you may want to email me the log output directly at tim@oxendale.net as it will contain some sensitive info.
Hey, I’m not sure about that one, just double-check the user is enabled please.
Other than that potentially I think the older version of Nextcloud might return data slightly differently. If you could go into the plugin file:
/wp-content/plugins/tims-nextcloud-sso-oauth2/includes/functions.phpAnd on line 105 change:
if($nextcloud_user->ocs->data->enabled == '1'){
to:
if($nextcloud_user->ocs->data->enabled){I think the older version of Nextcloud might return a true value as the new one a 1 value.
Let me know if that sorts it and I’ll get the plugin updated.
Hey, if you update to v1.2 it should be all sorted!
Hey, leave it with me, I have only tested it with 23.0.0, I’ll get a copy of 20.0.14 and see if I can figure out why!
Yeah, that’s extremely helpful haha, It’s getting nothing back from Nextcloud that’s why it’s blank, what version of Nextcloud are you using?
It should be getting the URL /index.php/ocs/v2.php/cloud/user?format=json which should return the username, email etc.. I did see on quite a few posts when building it, that some Nextcloud versions were a bit hit and miss with that URL.
Hey, so it should be retrieving the user details at that point but it’s getting something else back from Nextcloud.
I’m just pushing an update now that will better log the response, so if you could update the plugin to v1.1 and in WP go to Settings -> “Nextcloud OAuth2” and tick the new “Enable debug log” and then Save Changes.
Then try and login again with Nextcloud, then if you could send the contents of the new file over (it should be in your uploads folder) it should give me a bit more information as to what’s gone wrong.