This tutorial will explain how the new security that applies to nodeRED "Http In" nodes, used to expose endpoints with logic within the platform, works.
Let's assume an example such as the following one, in which an endpoint will be exposed:
...
- Authenticate against NodeRED's security. To do this, make the following call (in this case with CURL) with the indicated following parameters:
curl <environment_address>/nodered/<domain>/auth/token -d 'client_id=node-red-editor&grant_type=password&scope=*&username=<platform_username>&password=<user_API_token>'- Environment address: Environment base URL, for example https://lab.onesaitplatform.com/
- Domain: Name of the domain that contains the exposed point.
- Platform User: Platform User.
- Token: A user token generated for APIs.
The service will return a session token as follows
{"access_token":"FYbCpUJT4y9wvzgdpeGLyxcaEcZoKHR2EBUXhdI9dtjIhwDFXMeRsOXTaWMaAE2K0NxKqFHt1zcpOK2gCE71ZU1sC4RSjL8MXmWaUcKznLH2dSCqlUSoRa2dn2PXZ5G0","expires_in":604800,"token_type":"Bearer"}
- Invoke the endpoint with the header "X-OP-NODEKey" and, as the value, the token obtained in the previous step.
...
curl --data 'token=FYbCpUJT4y9wvzgdpeGLyxcaEcZoKHR2EBUXhdI9dtjIhwDFXMeRsOXTaWMaAE2K0NxKqFHt1zcpOK2gCE71ZU1sC4RSjL8MXmWaUcKznLH2dSCqlUSoRa2dn2PXZ5G0' -H "Authorization: Bearer FYbCpUJT4y9wvzgdpeGLyxcaEcZoKHR2EBUXhdI9dtjIhwDFXMeRsOXTaWMaAE2K0NxKqFHt1zcpOK2gCE71ZU1sC4RSjL8MXmWaUcKznLH2dSCqlUSoRa2dn2PXZ5G0" https://lab.onesaitplatform.com/nodered/myDomain/revoke