When connecting with SCP to pull the users using the API management.
Get the bearer token using the client key and secret and pass that to get the user details.
First call: To get the bearer token
POST: https://api.eu2.hana.ondemand.com/oauth2/apitoken/v1?grant_type=client_credentials
While providing authorization: you have ClientID and Secret from SCP ,so construct in the format below
Basic: ClientID:ClientSecret – Base64 format(https://www.base64encode.net/)
Authorization : Basic NzJlYjM3NDMtOTQ3OC0zMmI4LTItMDMwM2ZkNmQyNWE0OTVhOGY0LTBlMmMtM2Y0YS05ZTRmLTVkNmY5NzIzMDJjMw==
Output:
{
"access_token": "42d6da336c437955de45829a611f5b",
"token_type": "Bearer",
"expires_in": 1500,
"scope": "hcp.readAccountMembers hcp.manageAccountMembers hcp.manageAuthorizationSettings hcp.readAuthorizationSettings"
}
Second call: Access token to be passed as Bearer in this call and get the user details from SCP:
GET: https://api.eu1.hana.ondemand.com/authorization/v1/platform/accounts/a79a6ea13/Users
"key":"Authorization","value":"Bearer 42d6da336c437955de45829a611f5b
Output Data:
{
"Resources": [
{
"id": "C5200000",
"meta": {
"created": "2020-09-18T13:02:33.628Z",
"lastModified":
"2020-09-18T13:02:33.628Z",
"location": "https://apissecurity.hana.ondemand.com/authorization/v1/platform/accounts/a79a6ea10/Users/C5200000"
},
"schemas": [
"urn:sap:cloud:scim:schemas:extension:custom:2.0:UserExt",
"urn:ietf:params:scim:schemas:core:2.0:User"
],
"userName": "C5200000",
"name": {
"familyName": "C",
"givenName": "ramu"
},
"emails": [
{
"value": "ramu@gmail.com",
"primary": true
}
],
"roles": [
{
"value": "AccountAdministrator",
"primary": false,
"type": "Predefined"
}
],
"urn:sap:cloud:scim:schemas:extension:custom:2.0:UserExt": {
"userbase": "xxCOM",
"description":
"SAP API Management team"
}
}