Now that you’ve collected your details and created a listener endpoint, you can configure the webhooks subscription in Identity Cloud.
To complete this task, we will:
In this section, you’ll make RESTful API calls to the Identity Cloud using your platform or language of choice. We provide complete, pre-populated sample calls in cURL format.
We recommend using a platform called Postman - a downloadable application for making API calls easily. You can download Postman here.
In this guide, we use your inputs to generate the calls for you in cURL format, which you can import into Postman:
In order to create your webhooks subscription, you must first obtain an access token to authorize your configuration. To do this, you’ll make a call to the Hosted Login configuration endpoint: /login/token
This call requires Basic Authorization. To create the Basic Auth credentials value for this call, your configuration_client_id
and configuration_client_secret
must be combined with a colon in between (id:secret) and then Base64 encoded.
You can find the Configuration Client ID and Secret in the Identity Cloud Console:
configuration_client_id
and configuration_client_secret
settings under Global Settings in the Custom Settings section
What if I don’t have these settings? You may not have the configuration_client_id
and configuration_client_secret
settings if your original implementation of Identity Cloud predates Hosted Login. If you do not know your configuration client ID and secret, and do not know how to find them, please reach out to your Akamai Identity Cloud representative and we’ll be happy to help.
Postman will create the proper Basic Auth credentials value for you. All you need to do is:
configuration_client_id
as the Username and your configuration_client_secret
as the Password
When you Send the call, Postman will generate the Authorization header for you, and this will override the Authorization template from the imported call.
curl -X POST \
https://v1.api.REGION.janrain.com/CUSTOMER_ID/login/token \
-H 'Authorization: Basic CREDENTIALS' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials' \
-d 'scope=*:webhooks/**'
The scope
in this case will grant your token full read/write access to all /webhooks endpoints.
Enter the access_token
from your call’s response below. We’ll use this in next steps.
1abCde2f3ghI45J6KLmNoPqrstuvWXyZ-A78bcDe_9fg0hij-kL1MNOpQ2R_StU3
Now that you have an access token, you can use it to make the following Hosted Login configuration call for creating your webhooks subscription.
Unlike the previous /login/token call, which required Basic Authorization with an ID and secret, these calls require Bearer Token Authorization with the access token you just provisioned. This token lasts one hour - when it expires, you can provision a new one.
Call the /webhooks/subscriptions
endpoint with POST method to create your webhooks subscription.
Did you skip a step? In order for the call to be pre-populated with your values, you must complete all fields in the Gather Your Details section.
curl -X POST \
https://v1.api.REGION.janrain.com/CUSTOMER_ID/webhooks/subscriptions \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"enabled": true,
"endpoint": "LISTENER_ENDPOINT",
"events": [WEBHOOK_EVENTS],
"title": "SUBSCRIPTION_TITLE"
}'
Response Status | Response Body | Outcome |
---|---|---|
201 Created |
Your subscription details | The call was successful and your subscription has been created. |
"title": "Jane's Test Webhook"
). You must escape any apostrophe with a backslash before importing the call (example: "title": "Jane\'s Test Webhook"
).