Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.1k views
in Q2A Core by
I have tried to install QA with single sign-on option. I have done evrything following the online document. But when login is not happening on both sites (on my main site and on QA site.)

When I cofg external users php file, it was containing table name 'users'. but in my main database I have 'members' database. So I 'users' tablle name with members.  still its not working..

 

What should I do now?

2 Answers

+1 vote
by
I've been through this recently, so I might hopefully help. First of all: have you configured the external users php file PRIOR to Q&A install (at least the mandatory part of it)? Just asking this because I first missed that point when trying the system. Next do you share the same database for borh applications (if so which one), or separate databases? Finally: you mention none of your applications login is working. I find this weird, IMO, at least the master logon should work, Q2A is "just" calling user data from the "master" app. but it shouldn't break its login. BTW what is the 3rd party app.?
by
I have configured external users php file correctly before and after installing QA.
I share the same database for QA system.
Login on my main site is working and it has no problem for functioning. But single sign-on is not working.
I am using QA system with a fiverrscript site.
Any help? :)
0 votes
by
It seems that most probably your qa_get_logged_in_user() function is not correctly set up to retrieve the session data from your master app.

You need to tweak this function so that (depending on the session record process of your fiverrscript), it can retrieve id, username, email, access_level from your master app.

So this is not just about changing the usernme table in the function.

Say your session mecanism relies on some cookie called, my_app_cookie  and that in your app data to retrieve are located in my_app_user_table as follow
- id
- username
- email
- cookie_session_id
-access_level (if any for admin / standard user)

Something like the following should do the trick.
Note that this is a rough idea given as is that you need to adapt.

function qa_get_logged_in_user()
{
    if ($_COOKIE['my_app_cookie']) {
        $qa_db_connection=qa_db_connection();

    $result=mysql_fetch_assoc(
        mysql_query(
            "SELECT id, username, email, access_level FROM my_app_user_table WHERE cookie_session_id='".$_COOKIE['my_app_cookie']."'",
            $qa_db_connection
        )
    );

    if (is_array($result))
        return array(
            'userid' => $result['id'],
            'publicusername' => $result['username'],
            'email' => $result['email'],
            'level' => $result['access_level'] ? QA_USER_LEVEL_ADMIN : QA_USER_LEVEL_BASIC
        );
    }

    return null;
}
...