• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integrate Json authentication into codeigniter website

I current have a Codeigniter 3 framework website (called external system), and I just purchased a helpdesk php script that include 2 files Json Authentication that help connect with external system.

My purpose is when users go to helpdesk and login, they need to use my current website login information, so they dont have to sign up again (in this way, the user information of helpdesk and my Codeigniter script can keep the same).

Backend of helpdesk has some fields that need to provide like: url, site id, authentication key, create users on login.

Helpdesk script has 2 files and they need to be uploaded to external system, index.php and Authclass.php. Authclass.php is just class and function (no need to customize this). So i think Authclass.php will need to upload to library folder in Application of Codeigniter. The code of index.php is below.

Can anyone please help me or suggest where upload these files to codeigniter folder and how to modify to make it work?
Thank you so much


header('Cache-Control: no-cache, must-revalidate');
header('Content-Type: application/json; charset=utf-8');

$auth = new auth();

$send_array['success'] = 0;

if (isset($_POST['site_id']) && isset($_POST['data'])) {
  if ($_POST['site_id'] == 1) {

   /*Set your authentication key here*/

   $auth->set('key', '');

   $data = $auth->decrypt($_POST['data']);
   $receive_array = json_decode($data, true);
   if (is_array($receive_array)) {
       if ($receive_array['task'] == 'authenticate') {

           /*This would connect to your external database here.*/

           if ($receive_array['username'] == 'username' && $receive_array['password'] == 'password') {
               $send_array['success']  = 1;
               $send_array['name']     = 'example name';
               $send_array['email']    = '[email protected]';                
           echo $auth->encrypt(json_encode($send_array));  


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.