Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED UAPI Session

Discussion in 'cPanel Developers' started by Sebastian Ng, Jul 11, 2017.

Tags:
  1. Sebastian Ng

    Sebastian Ng Member

    Joined:
    May 2, 2017
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Penang, Malaysia
    cPanel Access Level:
    Root Administrator
    Does anyone here know what and where is $ENV{'REMOTE_DBOWNER'}?

    I am trying to use php UAPI session the result status is true but data is false.
    I am not sure what went wrong, i suspect something to do with $ENV{'REMOTE_DBOWNER'}.

    {"data":{"created":0},"errors":null,"messages":null,"metadata":{},"status":1}
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @Sebastian Ng,

    Here's a quote from our UAPI Functions - Session::create_temp_user document that explains the reference to "REMOTE_DBOWNER":

    Could you provide step-by-step instructions on how you are reproducing the issue? Please include the custom script you are using if possible.

    UAPI Functions - Session::create_temp_user - Software Development Kit - cPanel Documentation

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Sebastian Ng

    Sebastian Ng Member

    Joined:
    May 2, 2017
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Penang, Malaysia
    cPanel Access Level:
    Root Administrator
    <?php

    $user = "cpanel"; //not real
    $password = "cpanel password"; //not real
    $query = "http://localhost:2082/execute/Session/create_temp_user";

    //echo $query;
    $curl = curl_init(); // Create Curl Object
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); // Allow self-signed certs
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); // Allow certs that do not match the hostname
    curl_setopt($curl, CURLOPT_HEADER,0); // Do not include header in output
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); // Return contents of transfer on curl_exec
    $header[0] = "Authorization: Basic " . base64_encode($user.":".$password) . "\n\r";
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // set the username and password
    curl_setopt($curl, CURLOPT_URL, $query); // execute the query
    $result = curl_exec($curl);
    $resultjson = json_decode( $result );

    echo $resultjson->data->session_temp_user;
    echo $resultjson->data->created;
    echo $result;
    if ($result == false) {
    error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query"); // log error if curl exec fails
    }
    curl_close($curl);
    ?>

    result
    {"data":{"created":0},"errors":null,"messages":null,"metadata":{},"status":1}
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Sebastian Ng

    Sebastian Ng Member

    Joined:
    May 2, 2017
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Penang, Malaysia
    cPanel Access Level:
    Root Administrator
    Dear Michael,

    Can you tell me more about the difference between this 2 functions?
    I would like to experience more in future i know which to use.

    Thank you.

    Best regards,
    Sebastian Ng
     
  6. Sebastian Ng

    Sebastian Ng Member

    Joined:
    May 2, 2017
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Penang, Malaysia
    cPanel Access Level:
    Root Administrator
    Dear @cPanelMichael

    I am planing to call my own function from /frontend/paper_lantern/mail/own.html
    I try single sign on it doesn't work.

    Regards,
    Sebastian Ng
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    This is considered a cPanel plugin. We document the best approach to developing a cPanel plugin at:

    Guide to cPanel Plugins - Software Development Kit - cPanel Documentation

    Could you review this document (and the additional documents linked on it) and let us know if this helps clarify what's required?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Sebastian Ng

    Sebastian Ng Member

    Joined:
    May 2, 2017
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Penang, Malaysia
    cPanel Access Level:
    Root Administrator
    Dear @cPanelMichael ,

    How to set this thread as solve?

    Regards,
    Sebastian Ng
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Could you confirm if the document referenced in my last response was able to help answer your questions?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. Sebastian Ng

    Sebastian Ng Member

    Joined:
    May 2, 2017
    Messages:
    16
    Likes Received:
    4
    Trophy Points:
    3
    Location:
    Penang, Malaysia
    cPanel Access Level:
    Root Administrator
    @cPanelMichael,

    Yes the reference document did able to help me

    Sebastian
     
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice