Create webhooks subscription

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:

  1. Get a token to authorize your configuration
  2. Configure your webhooks subscription

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.

New to making API calls?

Get an access token

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.

Find my configuration client id and secret
How to create the Basic Auth header in Postman
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.

See example of an access token

Create your subscription

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.

Troubleshooting Tips