Skip to content

Latest commit

 

History

History
115 lines (98 loc) · 5.81 KB

File metadata and controls

115 lines (98 loc) · 5.81 KB

How to fetch tokens

Get your service configuration:

The documentation assumes the utility curl and awk to be installed (Mac OS: brew install curl, Ubuntu: sudo apt-get install curl). Alternatively, use Postman Rest Client.

IAS Tokens

Using X.509 Client Certificate
  1. Store the certificate and key from your service configuration in separate files in PEM format.

    ❗ In case you experience invalid PEM file errors, \n characters might have to be replaced by newlines \n to have the PEM in the correct format.

    awk '{gsub(/\\n/,"\n")}1' <file>.pem
  2. Fetch the token using:

    curl command

    ❗Replace the <<>> placeholders with the values from the service configuration.

    curl --cert certificate.pem --key key.pem -XPOST <<credentials.url>>/oauth2/token \
      -d 'grant_type=password&client_id=<<credentials.clientid>>&username=<<your ias user>>&password=<<your ias password>>'
    Postman
    1. In Postman navigate to Settings -> Certificates, click on "Add Certificate" and provide the certificate and key PEM files and host name.
    2. Import Postman Collection. For more info on how to import it in the Postman see learning.postman.com
    3. Fill in the corresponding ias_* Postman variables
    4. Open the 'IAS Token | pswd grant' Postman Collection and send the request
Using Client Credentials
  1. Fetch the token using:

    curl command

    ❗Replace the <<>> placeholders with the values from the service configuration.

    curl -XPOST -u '<<credentials.clientid>>:<<credentials.clientsecret>>' https://<<credentials.url>>/oauth2/token \
         -d 'grant_type=password&username=<<your ias user>>&password=<<your ias password>>'
    Postman
    1. Import Postman Collection. For more info how to import it in Postman see learning.postman.com
    2. Fill in the corresponding ias_* Postman variables
    3. Open the 'Ias Token | pswd grant' Postman Collection and send the request

XSUAA Tokens

Using X.509 Client Certificate
  1. Store the certificate and key from your service configuration in separate files in PEM format.

❗ In case you experience invalid PEM file errors, \n characters might have to be replaced by newlines \n to have the PEM in the correct format.

awk '{gsub(/\\n/,"\n")}1' <file>.pem
  1. Fetch the token using:

    curl command

    ❗Replace the <<>> placeholders with the values from the service configuration.

    curl --cert certificate.pem --key key.pem -XPOST <<credentials.certurl>>/oauth/token \
      -d 'grant_type=password&client_id=<<credentials.clientid>>&username=<<your xsuaa username>>&password=<<your xsuaa password>>'
    Postman
    1. In Postman navigate to Settings -> Certificates, click on "Add Certificate" and provide the certificate and key PEM files and host name.
    2. Import Postman Collection. For more info on how to import it in the Postman see learning.postman.com
    3. Fill in the corresponding xsuaa_* Postman variables
    4. Open the 'Xsuaa Token | pswd grant mTLS' Postman Collection and send the request
Using Client Credentials
  1. Fetch the token using:

    curl command

    ❗Replace the <<>> placeholders with the values from the service configuration.

    curl -X POST <<credentials.url>>/oauth/token \
         -H 'Content-Type: application/x-www-form-urlencoded' \
         -d 'client_id=<<credentials.clientid>>&client_secret=<<credentials.clientsecret>>&grant_type=password&username=<<your xsuaa username>>&password=<<your xsuaa password>>'
    
    Postman
    1. Import Postman Collection. For more info how to import it in Postman see learning.postman.com
    2. Fill in the corresponding xsuaa_* Postman variables
    3. Open the 'Xsuaa Token | pswd grant' Postman Collection and send the request