Accessing API with cURL
The following examples show how to request an access or refresh token by submitting a request on the REST resource using cURL.
To request an access token, submit a POST request.
$ curl -s --location -k --request POST 'https://<IAM_IP>/console/auth/realms/sbc/protocol/openid-connect/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type=password' --data-urlencode 'username=user1' --data-urlencode 'password=mypassword' --data-urlencode 'client_id=sbc' { "access_token": "eyJhbGciOi4NNzcxIiwia9rg", "refresh_token": "eyJhbGS6c_brRArB3KdcWRw", "token_type": "Bearer", "expires_in": 300, "refresh_expires_in": 1800, "not-before-policy": 0, "session_state": "42acd243-8991-4618-afe8-f9100f14dfc6", "scope": "profile" }
In the above, <IAM-IP> specifies either IAM IP address or IAM FQDN.