I am experimenting with the new files (mysql). Now I have some truble & need to ask:
Everytime I insert this:
$client = new mysqli_oauth_client_class;
I will get a HTTP-Error 500 (Internal Server Error).
$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?
$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!
Greetings from switzerland!
|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.
|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!
|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.