Send Auth0 Logs to Moesif Extension
Deploy this integration to ship Auth0 events from your Auth0 account to Moesif using custom log stream via webhooks.
Prerequisites
- An Auth0 account and tenant. Sign up for free.
- A Moesif account. Sign up for free.
Set up Moesif
To configure the integration with Moesif:
- Create a Moesif Account if you haven’t done so.
- Obtain your MOESIF APPLICATION ID through onboarding steps or under Settings > Installation.
Setup & Deploy Webhook Service
Copy the folder log-streams-webhook
from github repo https://github.com/Moesif/auth0-logs-to-moesif to your local drive. To verify if your can run the webhook.
$ npm install # If running yourself
added XX packages from XX contributors in XX.XXs
$ npm start # If running yourself
Listening on port 3050
# Replace the Authorization header below with MOESIF_APPLICATION_ID
$ curl \
--header "Authorization: MOESIF_APPLICATION_ID" \
--header "Content-Type: application/json" \
--request POST \
--data '[{"data": {"type": "f", "description": "Test failure", "log_id": "abc1234567890", "user_id": "testuser" }}]' \
http://localhost:3050/logs
Above should verify you are able to run the webhook, and see the event in your Moesif account.
Deploy the webhook to a cloud service of your choice, and obtain the host domain
.
Add the Auth0 Custom Webhook Stream
- In your Auth0 Dashboard, navigate to Monitoring > Streams, and select Create Stream.
- From the New Event Stream listing, select Custom Webhook.
- Enter a Name, and select Create.
- Locate the Payload URL field, and enter
https://[host domain]/logs
. - For Authorization Token: use your MOESIF_APPLICATION_ID.
- Locate the Content Type field, and select “application/json”.
- Locate the Content Format field, and select “JSON Array”.
- Save the changes and create the stream by selecting Save.
Trouble Shoot
In Auth0 check your data:
- Check the Dashboard Logs > Search screen to make sure the record is there.
- Check Health tab for stream and delivery attemped.
In Moesif check your data:
- Go to your Moesif Account
- Click on Start New -> Event Stream and verify the Auth0 event arrives.
Check for errors in your deployed webhook:
- Set
DEBUG = true
in to seeconsole.log
to verify- If your webhook service is receiving events from Auth0.
- If there is error transforming and sending events to Moesif.