Article ID: 129486, created on Sep 22, 2016, last review on Sep 22, 2016

  • Applies to:
  • Plesk Automation

Question

How to create Autologin with Global Session using an API request?

Answer

Perform the following steps:

  1. Check that Plesk Automation Management node are available to receive API requests using the following documentation.

  2. Create an XML file with the following content in case if you want to create the global session for TEST_USER user:

    <?xml version="1.0"?>
          <methodCall>
            <methodName>pem.mspsso.createGlobalSession</methodName>
            <params>
              <param>
                <value>
                  <struct>
                    <member>
                      <name>user_login</name>
                      <value><string>TEST_USER</string></value>
                    </member>
                 </struct>
               </value>
             </param>
          </params>
        </methodCall>
    

    NOTE: You should specify your own existing user name in the line with

    <value><string>%username%</string></value>
    
  3. Send created XML file to Plesk Automation using curl:

    # curl -k -d@test.xml https://admin:PASSWORD@{PA_MN_IP}:8440
    
  4. As a result you will get the following response:

    <?xml version="1.0" encoding="UTF-8"?>
        <methodResponse><params><param><value><struct><member><name>result</name><value><struct><member><name>cookie_name</name><value><string>SSOSID</string></value></member><member><name>cookie_value</name><value><string>eJyrViouzo9PSU1LLM0pUbJSKi8uNKkoTS9PKTfJTi01MskxMM+1LCzML0lNNcvLLkovSCpQqgUAEZoTmg==</string></value></member><member><name>session_id</name><value><string>wsq4xugwdw4keu24l07m9qqotee6nkrgpbp</string></value></member></struct></value></member><member><name>status</name><value><i4>0</i4></value></member></struct></value></param></params></methodResponse>
    
  5. Send POST and GET requests from a client application. For example, create the HTML file with the following code and opened in Web Browser:

    <form action='https://{PA_CP_ADDRESS}:8443/servlet/Turbine/frm/single/event1234submit/doPut/action/mspsso.CustomSessionHandler' method = 'post' target='_blank'>
    <input type='hidden' name='ppa_cookie_value' value='eJyrViouzo9PSU1LLM0pUbJSyipLsTQqLE9LLbEwt0xKS80tMzLKSTJITE01y81NTS01L1CqBQDtKxJl' />
    <input type='hidden' name='ppa_cookie_name' value='SSOSID' />
    <input type="submit" value="Open control panel" />
    </form>
    

The code above creates a web page with button Open control panel and when you click it is opens Plesk Automation hosting panel for user TEST_USER without authentication it by login and password.

This button could be integrated with billing solution, so your customers will be able to open Plesk Automation Panel from Billing without input of their user name and password.

NOTE: The process of retrieving the properties of a session could be automated as described in the following example.

Also required infromation can be founded in documentation.

Search Words

Autologin with global session

Session redirect fauls

Cannot login with COOKIE_VALUE AND COOKIE_NAME from API/RPC GLOBALSESSION

API

Global Session

Retrieving the properties of session using API request

e0aff7830fa22f92062ee4db78133079 caea8340e2d186a540518d08602aa065

Email subscription for changes to this article
Save as PDF