Sirportly

Toggle Menu

Authentication

If you would like to automatically log users into your support centres from a link within another website you can use the API to generate a login token. This token can then be passed to the support centre in an HTTP request in order to log a user into the desired support centre.

URL

/api/v2/authentication/support_centre_token

Access

Requests to this method must be authenticated with an account authentication token. User tokens are not permitted to use this method.

Supported Parameters

  • support_centre - the internal domain (i.e. 'codebase' if the internal domain is 'codebase.custservhq.com') or ID of the support centre (required)

You must also pass details for the contact which you wish to login as. You have two options, if you already know the contact's ID you can pass contact_id with the numeric ID. If you don't, you can pass the following parameters which will lookup the contact based on the reference or create a new contact with the details.

  • contact_reference - the reference for the contact
  • contact_name - the full name of the contact
  • contact_email - the email address for the contact

Example JSON

{
  "token": "fcc61053-8910-9c4b-ee25-9069aa4eeec5",
  "expires_at": "2012-03-01T11:47:17+00:00",
  "contact": {
    "id": 1,
    "reference": "dave",
    "name": "David Smith",
    "abbreviated_name": "David S",
    "company": "Dave's Pie Shop",
    "pin": "045712",
    "created_at": "2012-03-01T10:14:28+00:00"
  },
  "support_centre": {
    "id": 2,
    "access_domain": "atech.customerarea.dev",
    "access_domain_with_protocol": "http://atech.customerarea.dev",
    "brand": {
      "id": 2,
      "name": "Codebase",
      "url": "http://www.codebasehq.com",
      "phone": "01202 901 222"
    }
  }
}

Redirecting the User

Once you have generated the token, you should redirect the user to your support centre, passing the token (see example below), and optionally a return_to path. If you're using the cloud edition, you can redirect to either the internal or external domain.

http://yoursite.custservhq.com/login/{token}?return_to=/contact

Tokens are valid for one use and for one minute after generation so users must be redirected straight away in order to ensure they login. If the token is invalid, the user will just be redirected to the homepage of the support centre without a warning.