soudis / discoursesso

Nextcloud App providing Discourse SSO
GNU Affero General Public License v3.0
15 stars 5 forks source link

Discourse can't be accessed after setting up SSO #9

Closed vranki closed 4 years ago

vranki commented 4 years ago

I don't know if this an issue with documentation or an actual bug.

I've set up the SSO as instructed:

Nextcloud side: Discourse URL: https://forum.mysite.fi/ Client secret: *****

Discourse side:

enable_sso: Yes sso_url: https://intra.mysite.fi/discourse/sso sso_secret: **

Opening https://forum.mysite.fi/ redirects to Nextcloud - to login page if not logged in, or to files page if logged in. There's no way to access the forum anymore.

I also did the URL decode change mentioned in README, but no change in behavior.

Any ideas?

soudis commented 4 years ago

hmmm... I updated to 17 recently and accidentally used the LoginController.php of Nextcloud 16 with the mentioned fix and I had the same experience as you. But after I used the LoginController.php of Nextcloud 17 with the fix it worked again.

Can you provide the redirect history? If you use the network analysis feature of firefox you get all the URLs that you redirected to during the logon process. If you could provide that, I may find an answer.

vranki commented 4 years ago

Hi, here's a log of all 302 redirects in Firefox network analyzer when i try to open discourse (foorumi.tiy.fi). I hope it's helpful. I've censored some id's in cookies.

redirects.txt

soudis commented 4 years ago

Hmmm... did not see from the redirects, but I checked my code and saw that I forgot to check for trailing slashes in the discourse URL. Can you try to set den "Discourse URL" in the nextcloud config to "https://forum.mysite.fi" (without the trailing "/")? Hope it helps.

vranki commented 4 years ago

Hi, sorry for slow reply.

I removed the trailing slash from the forum URL, but unfortunately it still always goes to nextcloud when trying to open the forum.

soudis commented 4 years ago

Ah, now i can see where the problem is. You told discourse to go to

https://intra.mysite.fi/discourse/sso

for authentication, while it should be:

https://intra.mysite.fi/index.php/apps/discoursesso

Otherwise nextcloud does not know what to do and goes to files by default.

vranki commented 4 years ago

FYI I managed to get it working!

For further reference these settings work:

Nextcloud side:

Discourse URL: https://forum.mysite.fi/ Client secret: *****

Discourse side:

enable_sso: Yes sso_url: https://intra.mysite.fi/index.php/apps/discoursesso sso_secret: **

Thanks!