Managing CTERA Portal Users > Generate an Access Tokens to Impersonate a User
Generate an Access Tokens to Impersonate a User
To log in as another user you must generate an access token to use when logging in. You generate the access token as a super user administrator.
To create an administrator with super user privileges:
1 Log on to the portal as an administrator.
2 In the global administration view, select Settings in the navigation pane.
The Control Panel page is displayed.
3 Select User Roles, under USERS in the Control Panel page.
The Roles window is displayed.
4 Click the Read/Write Administrator role.
The Edit Role window is displayed.
5 Check the Super User checkbox.
To generate an access token:
1 Log in to a portal as described in Logging In using the super user administrator credentials.
2 Change the context to the global administration view, as described in Changing the Current Virtual Portal.
3 Issue the following to produce the access token:
API
admin/api
URI
http://portal_url/admin/api where portal_url is the URL of the portal.
HTTP Method
POST
Request Content-Type
application/xml
Request body
<obj>
  <att id="type">
    <val>user-defined</val>
  </att>
  <att id="name">
    <val>getSessionToken</val>
  </att>
  <att id="param">
    <obj class="SessionTokenParams">
      <att id="portal">
        <val>portalName</val>
      </att>
      <att id="username">
        <val>user</val>
      </att>
    </obj>
  </att>
</obj>
Expected Response status
A base64 encoded token, similar to the following:
anVsZXMvdGVhbTYwLDE1MjA4NzI3NzY3MjMsMjI5MCxlYzBkZTEzOTY0ZDhjMDdiZjFlMjc5MDIyNzUwZmZlNzI5ZGQ2MjYz
This token is returned as part of the response header in the X-CTERA-TOKEN key. You use this in every request header to perform actions as the user.
The request body:
portal – Mandatory: The portal with the user identified by username.
username – Mandatory: The username.
To log in to the portal using the access token:
*Issue the following:
API
ServicesPortal/sso
URI
https://portal_url/ServicesPortal/sso
where portal_url is the URL of a team portal to login to.
HTTP Method
POST
Request Content-Type
HTML
Request Header
X-CTERA-TOKEN key with the base64 encoded token as the value.
Request Body
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Login</title>
</head>
<body>
  <form action="/ServicesPortal/sso" method="post">
    <p>
      ctera ticket: <b/>
      <input type="text" name="ctera_ticket" />
    </p>
    <p>
      target Uri: <b/>
       <input type="text" name="targeturi"/>
    </p>
    <input type="submit" name="submit" value="Login" />
  </form>
</body>
Expected Response status
200 OK
If targeturi is not specified, the portal redirects to /.