PHP Classes

Error with: mysqli_oauth_client_class

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement a PH...  >  All threads  >  Error with: mysqli_oauth_client_class  >  (Un) Subscribe thread alerts  
Subject:Error with: mysqli_oauth_client_class
Summary:Questions: mysqli_oauth_client_class => HTTP-Error 500
Messages:4
Author:Beat Ottiger
Date:2013-05-02 08:54:42
Update:2013-05-02 20:44:08
 

  1. Error with: mysqli_oauth_client_class   Reply   Report abuse  
Picture of Beat Ottiger Beat Ottiger - 2013-05-02 08:54:42
Hi,

I am experimenting with the new files (mysql). Now I have some truble & need to ask:


1.) mysqli_oauth_client_class
------------------------------

Everytime I insert this:
$client = new mysqli_oauth_client_class;

I will get a HTTP-Error 500 (Internal Server Error).


With
$client = new oauth_client_class;
it works just fine - sure it does not store anything in the db.

The strange thing is, that with mysqli_oauth_client_class - the table oauth_session is successfully filled with sessions.

Hmm... any idea?


2.) user field in oauth_session table
--------------------------------------

The user fild is always '0'. With this lines - it should be '1' or?
if($success)
$success = $client->SetUser(1);



3.) store results in mysql
--------------------------------------

Does anybody have a solution to store the stdClass Object - like name, email & stuff to a mysql db? It would be very helpful for me!


Many thanks!

Greetings from switzerland!


  2. Re: Error with: mysqli_oauth_client_class   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-05-02 09:48:45 - In reply to message 1 from Beat Ottiger
Error 500 generaly means a syntax error or some other PHP fatal error.

Enable the PHP error log in your php.ini settings so you can check the error log file.

The SetUser call is only for use when authorizing the user, so the database stores the user in your application associated with the OAuth token.

Supposedly you already have in your application a table of users and each user has an id. The SetUser function takes the user of your users table so the tables can be associated to each other.

It is not up to the OAuth class to manage your application users. You should already have a way in place to create and update your application user records.

  3. Re: Error with: mysqli_oauth_client_class   Reply   Report abuse  
Picture of Beat Ottiger Beat Ottiger - 2013-05-02 11:32:11 - In reply to message 2 from Manuel Lemos

Thanks for your reply!

Error log file - I do not have access to this file... so debugging is difficult. Usualy I put some echo commands to see where the error is... maybe I find some better solutions.

I do have alredy a user table - so I want to store the current user id into to oauth session table. I am wondering why user is always '0' & not '1' as the call was.

Du you suggest me a good user management class for php - wich is working nice with you oauth?

Again - thanks!

  4. Re: Error with: mysqli_oauth_client_class   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-05-02 20:44:08 - In reply to message 3 from Beat Ottiger
I think you should create a test environment in your development machine to test what you are doing in a environment that you can control. I mean, install PHP and a Web server in your machine using a WAMP, XAMP or some other installation. Then you can control your PHP error log file to see any errors.

You need to set the user id to one that exists in your user system. If you already have a user system in place, use that. It would not make sense to use some other system.

The actual user id to set you need to determine from the context. You can query the OAuth server API to get for instance the user email address.

If there is already a user in your system with that email address, get its user id and set it in the OAuth class.

If the user does not exist with that email address, create a new user record in your system with that email address, get the created user id and set that to the OAuth class.