OAuth 2.0 is the industry standard protocol for authorisation. OAuth is an open-standard protocol that allows data sharing between parties with the consent of the user; without the user having to disclose passwords. Our APIs leverage OAuth protocols, using a standardised framework to ensure that using them is simple.
We use OAuth2 JWT flows to secure interactions. Below are CURL, HTTP or C# HttpClient examples for typical CIPC API flows to request, return and use a token, which is required to process queries. The CIPC API is sessionless, so each "session" always begins with the OAuth2 JWT Access Token Flow.
Access Token Flow
This flow shows the steps required to interact with the API
Send an HTTP POST request to the tokenUrl: /oauth2/token
POST /oauth20/token HTTP/1.1Host:<example.com>Ocp-Apim-Subscription-Key:a11...f1eeContent-Type:application/x-www-form-urlencodedContent-Length:189grant_type=password&client_id={client_id}&username={username}&password={password}&scope={scope}
Add a new Authorization header with type Bearer and the contents of the above access_token
POST </enterprise/information> HTTP/1.1Host: <apim.cipc.co.za> Authorization: Bearer yJ...124nOvcContent-Type: application/json; charset=utf-8Body: <...>
Once an access_token has been acquired, it can be used on all queries with an account until it returns a 401. If this occurs, simply request a new token using existing client_id, refresh_token and scopevalues, and set grant_type to refresh_token.