Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

How to execute an OAuth API Authentication

To execute this procedure, you should first guarantee that the client service setup is completed (https://must.atlassian.net/wiki/spaces/SIGNSTASH/pages/688129/Getting+Started#Client-Service-Setup)

In his walk through we will be referring to the following example, where the client service alias is PRT.505767457-PRT.111222333-e064c8c0-32ad-4dcf-9a76-f7542a5bae15 and the defined client service is test_123_Test_456_!!!

Steps:

  1. generate the base64 of the string relative to <client service alias>:<client service password>. In our example it would be PRT.505767457-PRT.111222333-e064c8c0-32ad-4dcf-9a76-f7542a5bae15:test_123_Test_456_!!! (please note the colon sign “:”).

    1. Example using https://www.base64encode.org/ will produce the encoded base64 credential string UFJULjUwNTc2NzQ1Ny1QUlQuMTExMjIyMzMzLWUwNjRjOGMwLTMyYWQtNGRjZi05YTc2LWY3NTQyYTViYWUxNTp0ZXN0XzEyM19UZXN0XzQ1Nl8hISE=

  2. Authenticate your client service with the base64 credential string

    1. Example using curl command (linux command line https://curl.se/docs/manpage.html )

      # Input Command
      curl --insecure -v -X POST https://staging.must.digital/oauth2/authorization-server/oauth/token -d "grant_type=client_credentials" -H "Authorization: Basic UFJULjUwNTc2NzQ1Ny1QUlQuMTExMjIyMzMzLWUwNjRjOGMwLTMyYWQtNGRjZi05YTc2LWY3NTQyYTViYWUxNTp0ZXN0XzEyM19UZXN0XzQ1Nl8hISE="
      
      # Output Response from service
      {"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOb24td3MiXSwic2NvcGUiOlsicmVhZCIsIndyaXRlIl0sImV4cCI6MTY1NjQyMTk4OCwianRpIjoiaU1IRWdrTUhySlc1MmVvdDZyaVlxN1gyUWdBIiwiY2xpZW50X2lkIjoiUFJULjUwNTc2NzQ1Ny1QUlQuMTExMjIyMzMzLWEwZjViOGIwLTk3OGUtNDUwMy04OTU4LTZmZTBjYzAyNmZhMCJ9.OfeSMcsHgnFak3fl1I31reu6f8evrVceYa_LA4YeJrsDkHJMiZfie0KnSflteWVYsTvydqteBZC7fd8mPxslIvzn20fwYvCp8OpnBCV0oYEnLuyfYbTmgJltHho7XenLTZXPa3WVQmvh7Jp9WJQWID7iH6qruZOX2iHBNLwNuLGr6R9jv9k7Vy78tjqjm0LlT6KUL41UehWr3hakMSUOlLk8PQIvmsm8MzzQBnFtPre3bsFxXbimg7s-EuzO4JxOFHO9cw2132kV1Q","token_type":"bearer","expires_in":86399,"scope":"read write","jti":"iMHEgkMHrJW52eot6rgA"}
  3. At this point you have successfully retrieved an access token to be used in the API business calls, and that will be expired in 86399 seconds (~24h)

Authenticating using Swagger UI

Instead of using the curl command for authenticating, this section describes the usage of Swagger UI available in https://must.atlassian.net/wiki/spaces/SIGNSTASH/pages/786720/Connecting+your+service#API-Definition-and-Examples .

Steps:

  1. Access Swagger GUI Authentication API in staging environment (see location here https://must.atlassian.net/wiki/spaces/SIGNSTASH/pages/786720/Connecting+your+service#API-Definition-and-Examples)

  2. Select option “Authorize”:

  3. Insert the client service alias and the defined client service secret and press “Authorize”. We’ll use the defined information stated in the beggining of this article.

  4. Access the detail of /oauth/token API function, and select “Try it out” option.

  5. Select “Execute” to perform a test call to authentication API.

  6. A response with a valid access token is returned from the authentication server.

  • No labels