PHP Classes

session parameters not being set

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement a PH...  >  All threads  >  session parameters not being set  >  (Un) Subscribe thread alerts  
Subject:session parameters not being set
Summary:login with fitbit, oauth 1.0a, no function parameters
Messages:4
Author:peter addy
Date:2015-09-03 20:02:02
 

  1. session parameters not being set   Reply   Report abuse  
Picture of peter addy peter addy - 2015-09-03 20:02:02
I am working with the login_with_fitbit.php example, using OAuth 1.0a and saving the authentication information in the MySQL table `oauth_session`. I can successfully do this on my development server. However, when I attempt this on my production server I get an unexpected error.

I create a new mysqli_client_class. My php log shows:
Checking the OAuth token authorization state
No OAuth session is set
Creating a new OAuth session
Query: INSERT INTO oauth_session (session, state, access_token, access_token_secret, expiry, authorized, type, server, creation, refresh_token, access_token_response) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

The log ends there. It looks like the session parameters are not being set.

FWIW, if I create a new oauth_client_class instead, the parameters are set, I am redirected to the Fitbit website, and the app is authorized. Then I get the error

Error message: Call to undefined method oauth_client_class::SetUser()

presumably because I am using the wrong class, and nothing is written to the `oauth_session` table. But this shows I am able to move past the Query INSERT INTO step and successfully connect to Fitbit.

Why does the mysqli_client_class not continue past the Query: INSERT INTO step? Any suggestions?

Thanks so much for creating this class!

  2. Re: session parameters not being set   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-09-04 02:06:16 - In reply to message 1 from peter addy
If nothing happens outputting the INSERT query to the error log, that means that the prepared statement failed.

Always check if the Initialize and Process functions return false. In that case check the error variable to figure what want wrong.

I suspect that the table schema you are using is not the most up to date and you may be missing some fields.

  3. Re: session parameters not being set   Reply   Report abuse  
Picture of peter addy peter addy - 2015-09-04 15:09:01 - In reply to message 2 from Manuel Lemos
I was using an older version of the SQL table with 12 rows instead of 13. I have now updated the SQL table but the result is the same. Initialize succeeds, but Process fails after the INSERT query, same as before. How do I check the error variable?

  4. Re: session parameters not being set   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-09-04 23:29:53 - In reply to message 3 from peter addy
Just access the error variable of the class.

error_log($client->error);