Codoforum related discussions
TEMP SOLVED: SSO integration not working

@adesh1414127033
Hi,
I am running CODOFORUM on my Raspberry Pi, and as you may know, they are VERY slow. I already had a problem with installation here, and I am now having SSO integration problems. When you click "login", it will send you to my login page, and then back to the forum after you have logged in. However, you have to click the refresh button EXTREMELY fast multiple times the moment you have reached the forum in order to get SSO to sign the user in (The little black dots that appear under the register/login buttons). This is obviously a problem with my server being to slow (I am 99% sure my configuration is okay, because it DOES log you in after refreshing very fast many times), and the server is not waiting long enough in order to get the SSO information from client.php. Is there a way to make the wait longer? (Modifying a file, etc.)

I am running:
PHP version: PHP 5.6.14-0+deb8u1

Apache version: 2.4.10 (Raspbian)

MySQL version: 14.14 Distrib 5.5.46, for debian-linux-gnu (armv7l) using readline 6.3

On a Raspberry Pi 1 Model B or B+

Thank you so much! Support is great on this forum, and it is absolutely amazing! Thank you for creating such a great product!

@adesh1414127033 Hi, I am running CODOFORUM on my Raspberry Pi, and as you may know, they are VERY slow. I already had a problem with installation [here](http://codologic.com/forum/index.php?u=/topic/5918/solved-installation-issues), and I am now having SSO integration problems. When you click "login", it will send you to my login page, and then back to the forum after you have logged in. However, you have to click the refresh button EXTREMELY fast multiple times the moment you have reached the forum in order to get SSO to sign the user in (The little black dots that appear under the register/login buttons). This is obviously a problem with my server being to slow (I am 99% sure my configuration is okay, because it DOES log you in after refreshing very fast many times), and the server is not waiting long enough in order to get the SSO information from client.php. Is there a way to make the wait longer? (Modifying a file, etc.) I am running: PHP version: PHP 5.6.14-0+deb8u1 Apache version: 2.4.10 (Raspbian) MySQL version: 14.14 Distrib 5.5.46, for debian-linux-gnu (armv7l) using readline 6.3 On a Raspberry Pi 1 Model B or B+ Thank you so much! Support is great on this forum, and it is absolutely amazing! Thank you for creating such a great product!
edited Jan 3 '16 at 10:12 pm

Instead of refreshin the browser many times, can you wait for sometime ?
It should be refreshed automatically.

Instead of refreshin the browser many times, can you wait for sometime ? It should be refreshed automatically.
edited Dec 26 '15 at 6:43 pm

@adesh1414127033 No, the dots below the login button that signify that SSO is logging a user in simply do NOT appear unless you refresh the page very fast. Opening the forum and just waiting does not work (I tried). Is there a way to make the site wait longer for a response from SSO? (My server is VERY slow)

@adesh1414127033 No, the dots below the login button that signify that SSO is logging a user in simply do NOT appear unless you refresh the page very fast. Opening the forum and just waiting does not work (I tried). Is there a way to make the site wait longer for a response from SSO? (My server is VERY slow)
edited Dec 26 '15 at 9:02 pm

is there a way to make the site wait longer for a response from SSO?

Do you mean the request made by codoforum to check if useris logged in ?

This is not configurable in the codoforum code, it is just a normal AJAX request.
The time-out for a request depends on server configuration.

The thing that is confusing us is how can refreshing the page very fast help with the user login.
Can you give us your forum url ? We will have a look at this issue.

>is there a way to make the site wait longer for a response from SSO? Do you mean the request made by codoforum to check if useris logged in ? This is not configurable in the codoforum code, it is just a normal AJAX request. The time-out for a request depends on server configuration. The thing that is confusing us is how can refreshing the page very fast help with the user login. Can you give us your forum url ? We will have a look at this issue.
edited Dec 27 '15 at 5:10 am

@adesh1414127033 Yes, the AJAX timeout not being long enough is the problem. I realized that refreshing the page really fast isn't the solution. For some reason, when you go to the forum, you won't be logged in on the forum, but you will be on the website. When you click around (click on topics, look at posts, etc.), after about 5 clicks, you will be logged in. Refreshing does the same thing. I am pretty sure it is just random, and the server is too slow to process the AJAX request fast enough. The code just moves on. The forum is not currently public, but if you want, we can set up a Chrome Remote Desktop session, and work it out together. Thank you for your time and help!
(The easiest solution would be a piece of code that would make the server wait for a response from the AJAX request for a longer period of time)
My time zone: UTC-8:00 (Pacific time)

@adesh1414127033 Yes, the AJAX timeout not being long enough is the problem. I realized that refreshing the page really fast isn't the solution. For some reason, when you go to the forum, you won't be logged in on the forum, but you will be on the website. When you click around (click on topics, look at posts, etc.), after about 5 clicks, you will be logged in. Refreshing does the same thing. I am pretty sure it is just random, and the server is too slow to process the AJAX request fast enough. The code just moves on. The forum is not currently public, but if you want, we can set up a Chrome Remote Desktop session, and work it out together. Thank you for your time and help! (The easiest solution would be a piece of code that would make the server wait for a response from the AJAX request for a longer period of time) My time zone: UTC-8:00 (Pacific time)
edited Dec 28 '15 at 6:09 pm

@adesh1414127033 I did some debugging, and found this:
I added timeout: 10000 to sso.js (/forum/sites/default/plugins/sso/assets), and added a few alerts to figure out what was going on. It turns out that sso.js is running the AJAX call, but is not running CODOF.authenticator.login, which means that response.name is not being set. What can I do to fix this? Thanks!

@adesh1414127033 I did some debugging, and found this: I added timeout: 10000 to sso.js (/forum/sites/default/plugins/sso/assets), and added a few alerts to figure out what was going on. It turns out that sso.js is running the AJAX call, but is not running CODOF.authenticator.login, which means that response.name is not being set. What can I do to fix this? Thanks!

@adesh1414127033 Additionally, this is what client.php shows up as in the "Resources" section in my browser: jQuery110209111299435608089_1451359287088({"error":"Invalid token","token":"6c2faff9346ccaf8184e965bb769a264"});

@adesh1414127033 Additionally, this is what client.php shows up as in the "Resources" section in my browser: jQuery110209111299435608089_1451359287088({"error":"Invalid token","token":"6c2faff9346ccaf8184e965bb769a264"});
edited Dec 29 '15 at 3:22 am

Invalid token can result due to mismatch of secrets set in the client.php file and codoforum sso plugin.

Or in rare cases if the timestamp timed out.

Invalid token can result due to mismatch of secrets set in the client.php file and codoforum sso plugin. Or in rare cases if the timestamp timed out.

@adesh1414127033 I checked the client and secret, made them shorter, made the timeout MUCH longer, and added some debug code in sso.js. When navigating, when sso finally decided to log me in, I got this in client.php in the console:

jQuery1102001238504471257329_1451422423046({"uid":"342","name":"Get300","mail":"get@test.org","avatar":"","token":"afc3bf609e113aa70d2536edde4e27e9"});

When you first load the forum, client.php doesn't even show UP in the console! The second time, it shows up, but shows the invalid token error. After a bit of navigating, it will give the message above in the console (in the file client.php), and refresh, logging the user in. Is the server not waiting long enough? How do I make the timestamp not time out? What can I do? Thank you!

@adesh1414127033 I checked the client and secret, made them shorter, made the timeout MUCH longer, and added some debug code in sso.js. When navigating, when sso finally decided to log me in, I got this in client.php in the console: jQuery1102001238504471257329_1451422423046({"uid":"342","name":"Get300","mail":"get@test.org","avatar":"","token":"afc3bf609e113aa70d2536edde4e27e9"}); When you first load the forum, client.php doesn't even show UP in the console! The second time, it shows up, but shows the invalid token error. After a bit of navigating, it will give the message above in the console (in the file client.php), and refresh, logging the user in. Is the server not waiting long enough? How do I make the timestamp not time out? What can I do? Thank you!
edited Dec 29 '15 at 8:59 pm

The only timeout that you can increase is defined in settings in client.php

but if you want, we can set up a Chrome Remote Desktop session, and work it out together.

Yes, this would be better.
We would get an idea as to what is actually happening.

The only timeout that you can increase is defined in settings in client.php >but if you want, we can set up a Chrome Remote Desktop session, and work it out together. Yes, this would be better. We would get an idea as to what is actually happening.
501
11
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft