HI Team,
I am trying to build a REST API in APEX with OAuth2 security. I am able to create roles, privilages and clients and associate them to secure the API.
Calling of the API from Postman, requires 2 steps:
First, get the Access Token by calling the the standard REST API using the Client ID and Client Secrets
https://<Host Name>/ords/wksp_billingworkspace/oauth/token
{
"access\_token": "xxxxxxxxxxxxxxxx",
"token\_type": "bearer",
"expires\_in": 3600
}
Second, Call the actual REST API and pass the Access Token from previous call as Bearer token.
https://<Host Name>/ords/wksp_billingworkspace/ccm/company/:company_id
This way it works fine. But, we need to provide this API to external application who will eventually call from their applications.
My question, is can we merge above two steps in one step? i.e, Can we accomodate the Access Token retrival in the main REST API call itself and use it as Bearer Token?
Thanks
Sandipan