Monday, October 3, 2016

How to setup OAuth 2.0 server using Apigility?

Software required 

- apigility 1.5
- composer version 1.2.0
- git version 2.10.0

Installation steps
  • Assume apigility has been upgraded to version 1.5 by executing the command below. Version before 1.5 is buggy
 composer update  
[APIGILITY_HOME] is your apigility installation home folder
  •  Launch your APIGILITY admin module, click on "Authentication" menu to launch the configuration page. Click "New adapter" button to launch the adapter configuration page.
  • Fill in the info as shown in the screenshot below, click on "Save" button to create adapter.

  •  Ensure the Status API authentication type is set to the newly created adapter, "oauth2".



 http://apigility/oauth/authorize?response_type=code&client_id=testclient&redirect_uri=/oauth/receivecode&state=xyz   
  • Approval page is displayed as shown in the screen below

  • Once the "testclient" is approved, an authentication code is generated.

  • Use postman with the configuration as shown in the screenshot below, generated access_token to access the API


  • Call the "status" api and "ping" services with the access_token as shown in the screenshot below.

Public Clients
  • client_secret value is omitted for this case. User ID, password and client_id is required. grant_type = "password" is used. Please refer to the screenshot below

Application Access

  • This is used for machine to machine integration. client_id and client_secret are required. grant_type = "client_credentials" is used. Please refer to the screenshot below