3.3.2. Making an OAuth Request
Usually an OAuth client library is used to generate the request. An example OAuth request using
curl
is shown here to aid in understanding how it works.
Example 3.1. OAuth Request Example Using curl
$In the example above architectures are listed using OAuth for authentication. The request is attempted as a user with login User1. If mapping is enabled in the Foreman settings, the result will only include architectures that user User1 can see. Note that the signature was constructed manually, this should change with anycurl 'https://satellite6.example.com/api/architectures' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json,version=2' \
-H 'FOREMAN-USER: User1' \
-H 'Authorization: OAuth oauth_version="1.0",oauth_consumer_key="secretkey",oauth_signature_method="hmac-sha1",oauth_timestamp=1321473112,oauth_signature=Il8hR8/ogj/XVuOqMPB9qNjSy6E='
oauth_timestamp
change. Also, the signature reflects every parameter, HTTP method, and URI change. Therefore it is recommend to use an OAuth client library to construct all OAuth parameters.