Automatic logging in to Plesk is especially useful for integration
purposes, so that customers who have logged in to some other system can
access Plesk without having to log in a second time.
The recommended way to implement automatic logging in is to redirect
users to a one-time use URL that contains a session token. To generate a
session token for a user, run an XML API request that uses the
create_session
operation of the server
operator.
An example of the request:
<packet version="1.6.3.3">
<server>
<create_session>
<login>admin</login>
<data>
<user_ip>MTAuNTAuMS43MQ==</user_ip>
<source_server></source_server>
</data>
</create_session>
</server>
</packet>
The login
parameter specifies the Plesk user for whom you need to
create a session. The user-ip
parameter is an IP address of the
user, encoded using the base64 algorithm.
An example of the response:
<packet version="1.6.3.3">
<server>
<create_session>
<result>
<status>ok</status>
<id>ede520d0fc93ae7aa0524076d631fba2</id>
</result>
</create_session>
</server>
</packet>
Plesk creates a session token for the specified user. It is contained in
the id
tag (ede520d0fc93ae7aa0524076d631fba2
in the example).
The generated session token can be used in scripts. A script redirects
the user’s browser to rsession_init.php
, and the user is…