HomeGuidesAPI ReferenceChangelogDiscussions
GuidesiMIS ProfessionaliMIS EnterpriseClient SupportLog In
Guides

Obtaining an access token for Single Sign On (SSO)

Obtaining an access token for SSO.

For full steps on how to use and test SSO with iMIS, review the iMIS Cloud help site.

Use the following to obtain an access token for SSO:

//Change the url, myClientId, mySuperSpecialSecret, and myRefreshToken. This can be sent through the browser's dev tools console (f12).
jQuery.ajax({
    "url": "http://YourOrgSite.com/token",
    "method": "POST",
      "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      "data": {
        "grant_type": "refresh_token",
        "client_id": "myClientId",
        "client_secret": "mySuperSpecialSecret",
        "refresh_token": "myRefreshToken"
      }})
      .done(function (data) {console.log(data);})
      .fail(function (data) {console.log(data);})
#Change the url, myClientId, mySuperSpecialSecret, and myRefreshToken.

curl --location --request POST 'http://YourOrgSite.com/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'client_id=myClientId' \
--data-urlencode 'client_secret=mySuperSpecialSecret' \
--data-urlencode 'refresh_token=myRefreshToken'
//Change the url, myClientId, mySuperSpecialSecret, and myRefreshToken.

var client = new RestClient("http://YourOrgSite.com/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("grant_type", "refresh_token");
request.AddParameter("client_id", "myClientId");
request.AddParameter("client_secret", "mySuperSpecialSecret");
request.AddParameter("refresh_token", "myRefreshToken");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
#Change the url, myClientId, mySuperSpecialSecret, and myRefreshToken.

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/x-www-form-urlencoded")

$body = "grant_type=refresh_token&client_id=myClientId&client_secret=mySuperSpecialSecret&refresh_token=myRefreshToken"

$response = Invoke-RestMethod 'http://YourOrgSite.com/token' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json