
How to Authenticate using Client Credentials flow
In order to get an access token allowing you to use SCG API you need two values: a Client Id and a Client Secret. Both of them are provided by the Smart Cable Guard Team.
The following Powershell code can be used to obtain an Access Token:
$Uri = "https://portal-east1.scg.dnvgl.com/auth/realms/SCG/protocol/openid-connect/token"$Body = @{"grant_type" = "client_credentials""client_id" = "{Client Id}""client_secret" = "{Client Secret}"}$token = Invoke-RestMethod -Uri $Uri -Method Post -Body $Body -ContentType "application/x-www-form-urlencoded"
Once obtained you pass it in your request in the form of a Bearer token, which means you add an Authorization header with the value "Bearer {token obtained}"
This Authorization header should be present in every call to the API.
The access token is valid for 30 minutes.