To obtain a SecureVue Authentication Token, use the following steps:
Query the JSON discovery document and obtain the token URL from the token_endpoint
property.
Issue a POST
request to the token_endpoint
with the Authorization header and the request body.
The request will use the Basic authentication scheme, and the value of the Authorization header will be a Base64 encoded string of your client_id
and client_secret
delimited with a colon.
If your client_id
is
MyCompany
and your client_secret
is Password123
, the Authorization header should be:
Basic TXlDb21wYW55OlBhc3N3b3JkMTIz
POST
body, you will set the following parameters:
grant_type=client_credentials
[Api_Name].[Version]
. Multiple scopes can be passed in separated by a space.
If you're going to use the token to the GetCustomerInformation
and GetServiceAppointment
API's version S5.12.4-D1.0, your scope parameter will be:
scope=GetCustomerInformation.S5.12.4-D1.0 GetServiceAppointment.S5.12.4-D1.0
curl --location --request POST 'https://vueauth-dms.dominiondms.com/connect/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --header 'Authorization: Basic TXlDb21wYW55OlBhc3N3b3JkMTIz' \ --form 'grant_type=client_credentials' \ --form 'scope=GetCustomerInformation.S5.12.4-D1.0 GetServiceAppointment.S5.12.4-D1.0'
On a successful token request, you will receive a JSON document that includes the token
, type
, expiration
in seconds, and scope(s)
.
{ "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IkM2ODcyMDUxOEZFNEVGRUE2NUMxNjBENDM1MkFCRUZGMzI4QTNCNjciLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiJ4b2NnVVlfazctcGx3V0RVTlNxLV96S0tPMmMifQ.eyJuYmYiOjE1ODE0NDU5NzIsImV4cCI6MTU4MTQ0OTU3MiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NDQzNzkiLCJhdWQiOlsiR2V0Q3VzdG9tZXJJbmZvcm1hdGlvbi5TNS4xMi40LUQxLjAiLCJHZXRTZXJ2aWNlQXBwb2ludG1lbnQuUzUuMTIuNC1EMS4wIl0sImNsaWVudF9pZCI6IkRPTTEwMDEiLCJjbGllbnRfcGFydHlJZCI6WyIxIiwiMiIsIjAwMDAwMDAiXSwiY2xpZW50X0FwaUFjY2VzcyI6WyJHZXRDdXN0b21lckluZm9ybWF0aW9uLlNWRDk5OTgwMS5TNS4xMi40LUQxLjAiLCJHZXRTZXJ2aWNlQXBwb2ludG1lbnQuU1ZEOTk5ODAxLlM1LjEyLjQtRDEuMCJdLCJzY29wZSI6WyJHZXRDdXN0b21lckluZm9ybWF0aW9uLlM1LjEyLjQtRDEuMCIsIkdldFNlcnZpY2VBcHBvaW50bWVudC5TNS4xMi40LUQxLjAiXX0.A5VTwcKCYjWhJqWHK_6jKY6yyNE-h84FoJAiWcGi3pH7F94j8_rxdMyRTB5SiRd3hu-scQoU9oHuy8Wny8swBmeOA1H2sMNlstggM953K88TM4CkwDNKmYeUdZ04R6fQzXZyIgauRFXrAsWj_PAaO13dQwX_6dmGXbVUnxbCHPulkB28V0qmnF1NC6BIOCgVOIRncUQDvkLgi7uE-z_Ouma7gaLRcw87gNMa6r90bganTB1xMgCpGwTq9Ns4alS5rLGHECnHGJ2taKJg1ReJf36Uy3sq7daj9S-XDiV1BGQ6UBnkAjQ43h9zTrmx2SwmCrKAwNsJVq_jjUcqsgzTax", "expires_in": 3600, "token_type": "Bearer", "scope": "GetCustomerInformation.S5.12.4-D1.0 GetServiceAppointment.S5.12.4-D1.0" }
An unsuccessful token request will return an Http Status of 400 with a description of the error
.
{ "error": "invalid_scope" }
{ "error": "unsupported_grant_type" }
{ "error": "invalid_client" }