Execute an Authorization Code Grant Flow with PKCE
Send Logging Events to Splunk
Splunk provides a platform that allows you to easily get insights into all the information generated by your IT infrastructure.
In this example, you will learn how to connect Auth0 to Splunk and stream
login events with user contextual information. To implement this with Auth0, you just need to create one Rule in your pipeline.
1. Create a Code Verifier
Record sign-up or log-in event in Splunk
Create a rule that will record user
login events for your apps using the Splunk REST API. When enabled, this rule will send events that will then show on Splunk's dashboard:
Splunk's API supports basic & token-based auth. In this example, we use token-based auth and expect your Splunk credentials to be stored in the global
configurationobject. Be sure to add your token here before running your rule. Doing this allows you to use your token in multiple rules and prevents you from having to store it directly in the code.
For this rule, we send contextual information, such as IP address (can be used to deduce location), application name, and username. However, you can send any number of properties.
For this rule, we track the event type using a property called
user.app_metadata.signedUp. When the property is set to
true, we assume the event is a
login. Otherwise, we assume the event is a new
signup, and if everything goes well, we set it to
true. Thus, the next time the user logs in, the event will be recorded as a
2. Create a Code Challenge
Check out our repository of Auth0 Rules for more great examples: