Machine to Machine
Client ID
JhLK6jO6TkWZmP39fiqxUGmjS3ttB2nA
A Machine to Machine Application represents a program that interacts with an API where there is no user involved. An example would be a server script that would be granted access to consume a Zip Codes API. It’s a machine to machine interaction.
1. Obtaining an Access Token by Calling the Token Endpoint
You can customize this documentation to any of your authorized APIs. To authorize more APIs, go to the APIs tab.Auth0 Management API
Your application can execute a client credentials exchange to get an access token for Auth0 Management API. You can find the client_id and client_secret in the Settings tab, the audience is the API identifier for the selected Auth0 API which can be found in the APIs tab.
require 'uri'
require 'net/http'
url = URI("https://dev-dn6dnob57lvn4m3z.us.auth0.com/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"client_id\":\"JhLK6jO6TkWZmP39fiqxUGmjS3ttB2nA\",\"client_secret\":\"OZnkbaWaLhIht1VleVMa84vjKAPmXmBDJZBJpJxDIlD6bAYk9XClfLykBsV7Lrcu\",\"audience\":\"https://dev-dn6dnob57lvn4m3z.us.auth0.com/api/v2/\",\"grant_type\":\"client_credentials\"}"
response = http.request(request)
puts response.read_body
2. Use the API token to Access your Protected API Endpoint
You can use this bearer token with an Authorization header to access your API.
See the available endpoints for the Management API Explorer.
curl --request GET \
--url https://dev-dn6dnob57lvn4m3z.us.auth0.com/api/v2/<Management API Endpoint> \
--header 'authorization: Bearer <Your Access Token>'

