I use CakePHP 2.4. I have an OAuth signin in my website. %99.5 of signins are successfull but %0.5 fails. I have this error for months. I tried many things to debug and log but still I didn't solve the problem. Although most of the requests are good I need to solve the small part.
Scenario is like this:
- User clicks Sign in button
- I get request token from server (for example yahoo, twitter)
- I save
oauth_token
in user's session
for example session ID isaaa1234
CakePHP creates PHPSESSID cookie and save session id in this cookie.
I redirect user to Twitter server and user confirms my application
- User comes to my website with oauth verifier
a) I use user'soauth_token
andoauth_verifier
and getaccess_tokens
. session ID isaaa1234
. everything good.
b) Failure. Because I can't find user'soauth_token
in current session. When I check session ID, I see that ID changed, ID is nowbbb2345
For the scenario b:
It seems like user has new session ID now. oauth_token
can't be found in new session. But note that old session data exists in /tmp/sessions/
folder.
Session ID cookie doesn't exists for session aaa1234
. But another tracking cookie that I set 2 days ago exists in cookies.
I check user agents.
It is same when user first comes and user comes back from Yahoo server.
This failure scenario happens in Chrome, Firefox, mobile browsers or other browsers, so I can't accuse browser type.
What should I check more to diagnose?
My CakePHP core.php settings:
Configure::write('Session', array( 'defaults' => 'cake' ));
Configure::write('Session.cookie', 'MYPHPSESSID');
Configure::write('Session.timeout', 120);
Configure::write('Security.level', 'medium');
Other settings are default as mentioned in file: https://github.com/cakephp/cakephp/blob/2.5/app/Config/core.php#L182
Edit: By using this answer I checked for cookies. 20% of the erroneous users disabled cookies. I asked personally and user confirmed cookie option. But it seems like other users didn't disabled cookies. Also some of users reach my website by using Android WebViews. In WebView clients I'm sure that I don't disable cookies. Also 99% of the WebView users can successfully use website.