### Install and Start Express.js Application Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/logs/streams/http-event-to-slack.md Commands to install project dependencies and start the local development server for the Express.js webhook. Assumes Node.js and npm are installed. ```bash npm install # If running yourself added XX packages from XX contributors in XX.XXs npm start # If running yourself Listening on port 3000 ``` -------------------------------- ### Install Rails Dependencies and Run Server (Bash) Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/rails/download.md Commands to install the necessary Ruby gems for the Rails application and start the local development server. Requires Ruby on Rails to be installed. ```bash bundle install rails s --port 3000 ``` -------------------------------- ### Install Auth0-PHP SDK using Composer Source: https://github.com/auth0/docs/blob/master/articles/libraries/auth0-php/index.md This command installs the Auth0-PHP SDK and its dependencies using Composer, the standard PHP package manager. It ensures the SDK is available for use in your project and creates a necessary autoload file. ```shell composer require auth0/auth0-php ``` -------------------------------- ### Go JWT Middleware Setup Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/quickstart/backend/golang/files/main.md Sets up a Go HTTP server with JWT authentication middleware. It loads environment variables, defines routes for public, private, and scoped access, and starts the server. Dependencies include go-jwt-middleware, godotenv, and the standard net/http package. ```go package main import ( "01-Authorization-RS256/middleware" "log" "net/http" jwtmiddleware "github.com/auth0/go-jwt-middleware/v2" "github.com/auth0/go-jwt-middleware/v2/validator" "github.com/joho/godotenv" ) func main() { if err := godotenv.Load(); err != nil { log.Fatalf("Error loading the .env file: %v", err) } router := http.NewServeMux() // This route is always accessible. router.Handle("/api/public", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write([]byte(`{"message":"Hello from a public endpoint! You don't need to be authenticated to see this."}')) })) // This route is only accessible if the user has a valid access_token. router.Handle("/api/private", middleware.EnsureValidToken()( http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write([]byte(`{"message":"Hello from a private endpoint! You need to be authenticated to see this."}')) }), )) // This route is only accessible if the user has a // valid access_token with the read:messages scope. router.Handle("/api/private-scoped", middleware.EnsureValidToken()( http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") token := r.Context().Value(jwtmiddleware.ContextKey{}).(*validator.ValidatedClaims) claims := token.CustomClaims.(*middleware.CustomClaims) if !claims.HasScope("read:messages") { w.WriteHeader(http.StatusForbidden) w.Write([]byte(`{"message":"Insufficient scope."}')) return } w.WriteHeader(http.StatusOK) w.Write([]byte(`{"message":"Hello from a private endpoint! You need to be authenticated to see this."}')) }), )) log.Print("Server listening on http://localhost:3010") if err := http.ListenAndServe("0.0.0.0:3010", router); err != nil { log.Fatalf("There was an error with the http server: %v", err) } } ``` -------------------------------- ### Install Dependencies and Start Application (Bash) Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/logs/streams/http-event-to-slack.md These bash commands are used to manage the Node.js project. `npm install` downloads and installs all the dependencies listed in `package.json`. `npm start` executes the script defined as 'start' in `package.json`, which in this case, runs the `app.js` file to launch the Express server. ```bash # Install dependencies npm install # added XX packages from XX contributors in XX.XXs # Start the application npm start # Listening on port 3000 ``` -------------------------------- ### Quickstart Article Structure with Includes (Markdown) Source: https://context7.com/auth0/docs/llms.txt Example of a quickstart article structure in Markdown, demonstrating the use of `include` statements for reusable content fragments and `snippet` calls for injecting code blocks. ```markdown --- title: Authorization description: This tutorial demonstrates how to add authorization to an Express.js API. topics: - quickstart - backend - nodejs --- <%= include('../../../_includes/_api_auth_intro') %> <%= include('../_includes/_api_create_new', { sampleLink: 'https://github.com/auth0-samples/auth0-express-api-samples' }) %> ## Install dependencies ${snippet(meta.snippets.dependencies)} ## Configure the middleware ${snippet(meta.snippets.setup)} ## Protect API endpoints ${snippet(meta.snippets.use)} ``` -------------------------------- ### Start Web Application (Bash) Source: https://github.com/auth0/docs/blob/master/articles/identity-labs/02-calling-an-api/exercise-01.md Starts the web application using npm. This command assumes Node.js and npm are installed and configured. It indicates that the application is listening on a specific port. ```bash #!/bin/bash npm start # Expected output: # listening on http://localhost:3000 ``` -------------------------------- ### Start API Server using npm Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/identity-labs/04-single-page-app/exercise-01.md Starts the Node.js API server. This command assumes that `npm install` has been successfully run and the `.env` file is correctly configured. ```bash ❯ npm start ``` -------------------------------- ### Initialize Auth0 SDK and Get Bearer Token (PHP) Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/backend/php/files/index.md This snippet shows how to set up the Auth0 SDK for PHP using API strategy, including domain, client ID, client secret, and audience. It then demonstrates retrieving a bearer token from an Authorization header. Dependencies include the Auth0 SDK installed via Composer. ```php getBearerToken( get: ['token'], server: ['Authorization'] ); require('router.php'); ``` -------------------------------- ### Build and Run Sample with Gradle Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/java-spring-boot/download.md Commands to build and run the sample application using Gradle. These commands clean the project and then execute the bootRun task to start the application. Assumes Java is installed. ```bash # In Linux / macOS ./gradlew clean bootRun ``` ```bash # In Windows gradlew clean bootRun ``` -------------------------------- ### Install mod_auth_openidc Module for Apache Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/apache/01-login.md This snippet details the commands to install and enable the `mod_auth_openidc` module, which is necessary for integrating Auth0 authentication with Apache. It assumes a Debian-based system and may require adjustments for other operating systems. ```bash sudo apt-get update sudo apt-get install libapache2-mod-auth-openidc ``` -------------------------------- ### Serve Go Application Entry Point Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/golang/01-login.md Sets up the main entry point for the Go application. It loads environment variables, initializes the authenticator, creates the router, and starts the HTTP server. Dependencies include log, net/http, and github.com/joho/godotenv. ```go // main.go package main import ( "log" "net/http" "github.com/joho/godotenv" "01-Login/platform/authenticator" "01-Login/platform/router" ) func main() { if err := godotenv.Load(); err != nil { log.Fatalf("Failed to load the env vars: %v", err) } auth, err := authenticator.New() if err != nil { log.Fatalf("Failed to initialize the authenticator: %v", err) } rtr := router.New(auth) log.Print("Server listening on http://localhost:3000/") if err := http.ListenAndServe("0.0.0.0:3000", rtr); err != nil { log.Fatalf("There was an error with the http server: %v", err) } } ``` -------------------------------- ### Install Android Sample App from Command Line Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/native/android/download.md Commands to install the Android sample application using Gradle. This command compiles and installs the debug version of the application onto a connected Android device or emulator. ```bash # In Linux / macOS ./gradlew installDebug ``` ```bash # In Windows gradlew installDebug ``` -------------------------------- ### Get Token using Node.js Request Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/api/authentication/api-authz/_client-credential.md Shows how to retrieve an access token using the 'request' npm package in Node.js. This example demonstrates setting up the POST request options, including the URL, headers, and form data, and handling the response or errors. Ensure the 'request' package is installed (`npm install request`). ```javascript var request = require("request"); var options = { method: 'POST', url: 'https://${account.namespace}/oauth/token', headers: { 'content-type': 'application/x-www-form-urlencoded' }, form: { client_id: '${account.clientId}', client_secret: 'YOUR_CLIENT_SECRET', audience: 'API_IDENTIFIER', grant_type: 'client_credentials' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` -------------------------------- ### Initialize NPM Project Source: https://github.com/auth0/docs/blob/master/articles/quickstart/spa/vanillajs/_includes/_centralized_login.md This command initializes a new Node.js project in the current directory using NPM. It creates a `package.json` file to manage project dependencies and scripts. ```bash npm init -y ``` -------------------------------- ### GET /api/v2/users with Wildcard Search Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/users/search/v3/query-syntax.md This example shows how to perform a wildcard search for user names starting with 'john'. ```APIDOC ## GET /api/v2/users ### Description Searches for users using a query string that includes wildcard characters for pattern matching. ### Method GET ### Endpoint https://${account.namespace}/api/v2/users ### Query Parameters - **q** (string) - Required - The query string to search for users. Supports wildcard searches using the asterisk (*). - **search_engine** (string) - Required - Specifies the search engine version, e.g., "v3". ### Request Example ```json { "method": "GET", "url": "https://${account.namespace}/api/v2/users", "httpVersion": "HTTP/1.1", "headers": [ { "name": "Authorization", "value": "Bearer YOUR_MGMT_API_ACCESS_TOKEN" } ], "queryString": [ { "name": "q", "value": "name:john*" }, { "name": "search_engine", "value": "v3" } ] } ``` ### Response #### Success Response (200) - **users** (array) - An array of user objects matching the wildcard search criteria. - **total** (integer) - The total number of users found. - **start** (integer) - The starting index of the results. - **limit** (integer) - The limit of results returned per page. #### Response Example ```json { "users": [ { "name": "john doe", "email": "john.doe@example.com" }, { "name": "johnny appleseed", "email": "johnny.a@example.com" } ], "total": 2, "start": 0, "limit": 50 } ``` ``` -------------------------------- ### Initialize and Run Go HTTP Server with Auth0 Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/golang/files/main.md This Go code initializes the application by loading environment variables, setting up the Auth0 authenticator, and starting an HTTP server. It depends on the 'github.com/joho/godotenv' package for environment variables and custom platform modules for authenticator and router. ```go package main import ( "log" "net/http" "github.com/joho/godotenv" "01-Login/platform/authenticator" "01-Login/platform/router" ) func main() { if err := godotenv.Load(); err != nil { log.Fatalf("Failed to load the env vars: %v", err) } auth, err := authenticator.New() if err != nil { log.Fatalf("Failed to initialize the authenticator: %v", err) } rtr := router.New(auth) log.Print("Server listening on http://localhost:3000/") if err := http.ListenAndServe("0.0.0.0:3000", rtr); err != nil { log.Fatalf("There was an error with the http server: %v", err) } } ``` -------------------------------- ### Initialize and Run Go HTTP Server with Auth Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/quickstart/webapp/golang/files/main.md This Go code sets up the main application flow. It loads environment variables, initializes the authenticator, creates a router, and starts an HTTP server. Dependencies include 'github.com/joho/godotenv' for environment variables and custom packages '01-Login/platform/authenticator' and '01-Login/platform/router'. The server listens on port 3000. ```go // Save this file in ./main.go package main import ( "log" "net/http" "github.com/joho/godotenv" "01-Login/platform/authenticator" "01-Login/platform/router" ) func main() { if err := godotenv.Load(); err != nil { log.Fatalf("Failed to load the env vars: %v", err) } auth, err := authenticator.New() if err != nil { log.Fatalf("Failed to initialize the authenticator: %v", err) } rtr := router.New(auth) log.Print("Server listening on http://localhost:3000/") if err := http.ListenAndServe("0.0.0.0:3000", rtr); err != nil { log.Fatalf("There was an error with the http server: %v", err) } } ``` -------------------------------- ### Install vlucas/phpdotenv for .env file parsing Source: https://github.com/auth0/docs/blob/master/articles/libraries/auth0-php/index.md This command installs the 'vlucas/phpdotenv' library using Composer, which is required to load environment variables from a .env file into your PHP application. This is necessary because PHP cannot natively read .env files. ```shell composer require vlucas/phpdotenv ``` -------------------------------- ### Make API Call with JWT (Node.JS) Source: https://github.com/auth0/docs/blob/master/articles/quickstart/backend/nodejs/interactive.md This Node.js example utilizes the Axios library to send a GET request to an API endpoint. It includes setting the 'Authorization' header with a Bearer token. Ensure Axios is installed via npm or yarn. ```javascript var axios = require("axios").default; var options = { method: 'get', url: 'http:///%7ByourDomain%7D/api_path', headers: {authorization: 'Bearer YOUR_ACCESS_TOKEN_HERE'} }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); }); ``` -------------------------------- ### Install Express Server Dependency Source: https://github.com/auth0/docs/blob/master/articles/quickstart/spa/vanillajs/_includes/_centralized_login.md This command installs the Express.js framework, a popular Node.js web application framework, as a production dependency for the project. ```bash npm install express ``` -------------------------------- ### Go Application Entry Point Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/quickstart/webapp/golang/01-login.md The main.go file serves as the application's entry point. It loads environment variables, initializes the authenticator, sets up the router, and starts the HTTP server. Dependencies include 'log', 'net/http', 'github.com/joho/godotenv', and custom platform packages 'authenticator' and 'router'. ```go // main.go package main import ( "log" "net/http" "github.com/joho/godotenv" "01-Login/platform/authenticator" "01-Login/platform/router" ) func main() { if err := godotenv.Load(); err != nil { log.Fatalf("Failed to load the env vars: %v", err) } auth, err := authenticator.New() if err != nil { log.Fatalf("Failed to initialize the authenticator: %v", err) } rtr := router.New(auth) log.Print("Server listening on http://localhost:3000/") if err := http.ListenAndServe("0.0.0.0:3000", rtr); err != nil { log.Fatalf("There was an error with the http server: %v", err) } } ``` -------------------------------- ### Example API Call: Get All Clients (HAR) Source: https://github.com/auth0/docs/blob/master/articles/api/management/v2/get-access-tokens-for-production.md This HAR example shows a GET request to the /api/v2/clients endpoint to retrieve all client applications. It includes the necessary Authorization header with a Bearer Access Token. ```har { "method": "GET", "url": "https://${account.namespace}/api/v2/clients", "headers": [ { "name": "Content-Type", "value": "application/json" }, { "name": "Authorization", "value": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ik5ESTFNa05DTVRGQlJrVTRORVF6UXpFMk1qZEVNVVEzT1VORk5ESTVSVU5GUXpnM1FrRTFNdyJ9.eyJpc3MiOiJodHRwczovL2RlbW8tYWNjb3VudC5hdXRoMC5jb20vIiwic3ViIjoib9O7eVBnMmd4VGdMNjkxTnNXY2RUOEJ1SmMwS2NZSEVAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vZGVtby1hY2NvdW50LmF1dGgwLmNvbS9hcGkvdjIvIiwiZXhwIjoxNDg3MDg2Mjg5LCJpYXQiOjE5ODY5OTk4ODksInNjb3BlIjoicmVhZDpjbGllbnRzIGNyZWF0ZTpjbGllbnRzIHJlYWQ6Y2xpZW50X2tleXMifQ.oKTT_cEA_U6hVzNYPCl_4-SnEXXvFSOMJbZyFydQDPml2KqBxVw_UPAXhjgtW8Kifc_b2HQ4jFh7nH0KC_j1XjfEJPvwFZgqfI_ILzO3DPfpEIK_n_aX-Tz4okbZe6nj2aT_qLpHimLxK50jOGaMuzp4a1djHJTj5q-NbIiPW8AJowS2-gveP4T3dyyegUsZkmTNwrreqppPApmpWWE-wVsxnVsI_FZFrHnq0rn7lmY_Iz6vyiZjaKrd2C3hFm0zFGTn8FslBfHUldTcDNzOKOpCq7HFMeU0urXBXDetrzkW1afxIqED3G2C51JEV-4nTRYUinnWgXJfLJ87G3ge_A"} ] } ``` -------------------------------- ### Install AD/LDAP Connector Dependencies and Start Server (Shell) Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/connector/install-other-platforms.md These commands install the AD/LDAP Connector on a non-Microsoft platform. It involves creating a directory, extracting the downloaded package, installing Node.js dependencies using npm, and starting the server. The configuration is done via the config.json file. ```shell mkdir /opt/auth0-adldap tar -xzf /tmp/adldap.tar.gz -C /opt/auth0-adldap --strip-components=1 cd /opt/auth0-adldap npm install ``` ```shell node server.js ``` -------------------------------- ### Implement Logout Button with Auth0 in React Native Source: https://github.com/auth0/docs/blob/master/articles/quickstart/native/react-native/00-login.md This example shows how to implement a logout button that clears the user's session with Auth0. It utilizes the `clearSession` method from the `useAuth0` hook. This requires the `react-native-auth0` package to be installed and configured. ```javascript import React from 'react'; import { Button, Text } from 'react-native'; import {useAuth0} from 'react-native-auth0'; const LogoutButton = () => { const {clearSession} = useAuth0(); const onPress = async () => { try { await clearSession(); } catch (e) { console.log(e); } }; return } ``` -------------------------------- ### Systemd Service File for AD/LDAP Connector (Systemd Unit) Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/connector/install-other-platforms.md This is an example systemd service file for Ubuntu Xenial to run the AD/LDAP Connector as a background service. It defines the service description, restart policy, user, working directory, and the command to start the server. ```systemd [Unit] Description=Auth0 AD LDAP Agent After=network.target [Service] Type=simple Restart=always User=ubuntu WorkingDirectory=/opt/auth0-adldap ExecStart=/usr/bin/node server.js ``` -------------------------------- ### Java Login Servlet for Auth0 Authentication Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/webapp/java-ee/files/src/main/java/com/auth0/example/web/LoginServlet.md This Java Servlet handles incoming GET requests to the /login endpoint. It constructs the Auth0 authorization URL using provided configuration and redirects the user's browser to start the authentication process. It requires Auth0AuthenticationConfig and AuthenticationController dependencies. ```java import com.auth0.example.web.Auth0AuthenticationConfig; import com.auth0.example.web.AuthenticationController; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.inject.Inject; import java.io.IOException; @WebServlet(urlPatterns = "/login") public class LoginServlet extends HttpServlet { private final Auth0AuthenticationConfig config; private final AuthenticationController authenticationController; @Inject LoginServlet(Auth0AuthenticationConfig config, AuthenticationController authenticationController) { this.config = config; this.authenticationController = authenticationController; } @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // URL where the application will receive the authorization code (e.g., http://localhost:3000/callback) String callbackUrl = String.format( "%s://%s:%s/callback", request.getScheme(), request.getServerName(), request.getServerPort() ); // Create the authorization URL to redirect the user to, to begin the authentication flow. String authURL = authenticationController.buildAuthorizeUrl(request, response, callbackUrl) .withScope(config.getScope()) .build(); response.sendRedirect(authURL); } } ``` -------------------------------- ### GET User by ID with Access Token Source: https://github.com/auth0/docs/blob/master/articles/migrations/guides/calling-api-with-idtokens.md Example of how to call the GET User by ID endpoint using an Access Token obtained via the Authorization endpoint. ```APIDOC ## GET /api/v2/users/{user_id} ### Description Retrieves the full profile information of a specific user using their ID. This endpoint is accessed after obtaining an Access Token. ### Method GET ### Endpoint https://${account.namespace}/api/v2/users/USER_ID ### Parameters #### Path Parameters - **USER_ID** (string) - Required - The unique identifier of the user. #### Headers - **Authorization** (string) - Required - Bearer YOUR_MGMT_API_ACCESS_TOKEN ### Request Example ```har { "method": "GET", "url": "https://${account.namespace}/api/v2/users/USER_ID", "headers": [{ "name": "Authorization", "value": "Bearer YOUR_MGMT_API_ACCESS_TOKEN" }] } ``` ### Response #### Success Response (200) - **userProfile** (object) - The full profile information of the user. ``` -------------------------------- ### Basic HTML Structure for SPA Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/quickstart/spa/vanillajs/_includes/_centralized_login.md This HTML file sets up the basic structure for a Single Page Application, including elements for login/logout buttons and a welcome message. It links to external CSS and JavaScript files, and references the Auth0 SPA SDK via CDN. ```html
Welcome to our page!
``` -------------------------------- ### Shell Command for Go Dependency Download Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/golang/01-login.md A shell command to download all the dependencies listed in the go.mod file. This command ensures that all necessary libraries are available for the project. ```shell go mod download ``` -------------------------------- ### Make GET Request to Auth0 API (Swift) Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/backend/django/interactive.md This Swift code example shows how to make a GET request to the Auth0 API using URLSession. It covers creating an NSMutableURLRequest, setting the HTTP method and headers, and handling the response data or errors. Requires the Foundation framework. ```swift import Foundation let headers = ["authorization": "Bearer YOUR_ACCESS_TOKEN_HERE"] let request = NSMutableURLRequest(url: NSURL(string: "http:///${account.namespace}.com/api_path")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "get" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Build and Run Sample with Gradle Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/java/download.md Execute these commands in the sample's directory to clean the project and run the application using Gradle. Ensure Java is installed on your system. These commands differ slightly between Linux/macOS and Windows. ```bash # In Linux / macOS ./gradlew clean appRun ``` ```bash # In Windows gradlew clean appRun ``` -------------------------------- ### Configure NPM Scripts for Development and Production Source: https://github.com/auth0/docs/blob/master/articles/quickstart/spa/vanillajs/_includes/_centralized_login.md This JSON snippet modifies the 'scripts' section of the `package.json` file. It defines 'start' to run the server using Node.js and 'dev' to run the server using Nodemon for development with automatic restarts. ```json { // ... "scripts": { "start": "node server.js", "dev": "nodemon server.js" }, // ... } ``` -------------------------------- ### GET /api/v2/logs - Get Logs by Checkpoint Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/logs/guides/retrieve-logs-mgmt-api.md Retrieves logs starting from a specific log event ID. This method is recommended for exporting logs and is efficient for large log volumes. ```APIDOC ## GET /api/v2/logs ### Description Retrieves logs starting from a specific log event ID. This method is recommended for exporting logs and is efficient for large log volumes. When fetching logs by checkpoint, only `from` and `take` parameters are considered, and the order by date is not guaranteed. ### Method GET ### Endpoint /api/v2/logs ### Query Parameters #### Path Parameters - None #### Query Parameters - **from** (string) - Required - Log Event Id to start retrieving logs. - **take** (integer) - Optional - The total amount of entries to retrieve when using the `from` parameter. Defaults to 100. ### Request Example ```http GET /api/v2/logs?from=log_event_id_123&take=50 ``` ### Response #### Success Response (200) - **logs** (array) - An array of log event objects. - **log_id** (string) - The ID of the log event. - **created_at** (string) - The timestamp when the log was created. - **type** (string) - The type of the log event. - **description** (string) - A description of the log event. - **user_id** (string) - The ID of the user associated with the log event. - **ip** (string) - The IP address from which the action was performed. - **user_agent** (string) - The user agent string. - **details** (object) - Additional details about the log event. #### Response Example ```json { "logs": [ { "log_id": "log_event_id_123", "created_at": "2023-10-27T10:00:00Z", "type": "s\ Sso", "description": "User logged in via SAML", "user_id": "auth0|user123", "ip": "192.168.1.1", "user_agent": "Mozilla/5.0", "details": { "connection": "SAML Connection", "saml_subject": "user123" } } ] } ``` ``` -------------------------------- ### Run Sample with Docker Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/java/download.md Instructions for executing the sample project using a Docker image. These commands are used to start the containerized application. The specific command depends on your operating system. ```shell # In Linux / macOS sh exec.sh ``` ```powershell # In Windows' Powershell ./exec.ps1 ``` -------------------------------- ### Start Express API Server Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/identity-labs/02-calling-an-api/exercise-02.md Initiate your Express API server using npm. This command assumes your project has a 'start' script defined in its `package.json` file, typically running your main server file. ```bash ❯ npm start ``` -------------------------------- ### GET /api/v2/logs - Get logs by checkpoint Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/logs/guides/retrieve-logs-mgmt-api.md Retrieves logs starting from a specific log event ID. This method is recommended for exporting logs and supports limiting the number of entries. ```APIDOC ## GET /api/v2/logs ### Description Retrieves logs from a particular `log_id` using the checkpoint method. Supports limiting the amount of logs retrieved. ### Method GET ### Endpoint /api/v2/logs ### Parameters #### Query Parameters - **from** (string) - Required - Log Event Id to start retrieving logs. - **take** (integer) - Optional - The total amount of entries to retrieve when using the `from` parameter. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **logs** (array) - An array of log objects. - **length** (integer) - The number of logs returned. #### Response Example ```json { "logs": [ { "_id": "some_log_id", "created_at": "2023-01-01T10:00:00.000Z", "type": "sso", "log_id": "some_log_id", "ip": "127.0.0.1", "user_agent": "Mozilla/5.0", "details": {}, "tenant": "your_tenant" } ], "length": 1 } ``` ``` -------------------------------- ### GET /api/v2/logs - Get logs by checkpoint Source: https://github.com/auth0/docs/blob/master/articles/logs/guides/retrieve-logs-mgmt-api.md Retrieves logs starting from a specific log event ID. This method is recommended for exporting logs to external systems and is useful for large-scale log retrieval. ```APIDOC ## GET /api/v2/logs ### Description Retrieves log entries starting from a specific log event ID. This method is primarily for exporting logs and supports limited parameters. ### Method GET ### Endpoint /api/v2/logs ### Parameters #### Query Parameters - **from** (string) - Required - Log Event Id to start retrieving logs. - **take** (integer) - Optional - The total amount of entries to retrieve when using the `from` parameter. ### Request Example ```json { "example": "GET /api/v2/logs?from=some_log_id&take=100" } ``` ### Response #### Success Response (200) - **logs** (array) - An array of log event objects. - **length** (integer) - The number of log entries returned. #### Response Example ```json { "logs": [ { "event_timestamp": "2023-10-27T10:00:00.000Z", "client_id": "your_client_id", "client_name": "Your App Name", "ip": "127.0.0.1", "user_agent": "Mozilla/5.0", "details": {}, "type": "sso_start", "user_id": "auth0|1234567890abcdef", "connection": "your_connection", "realm": "your_realm", "strategy": "auth0", "organization": "your_org_id" } ], "length": 1 } ``` ``` -------------------------------- ### Install the Auth0 SDK Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/quickstart/native/_includes/_facebook_login_howto.md Install the Auth0 SDK for your application to facilitate the exchange of Facebook data for Auth0 tokens. ```APIDOC ## Install the Auth0 SDK *This section requires a code snippet or configuration example that is not provided in the input text.* ``` -------------------------------- ### Retrieve Users with GET /api/v2/users Endpoint (HAR) Source: https://github.com/auth0/docs/blob/master/fr-ca/articles/users/search/v3/get-users-endpoint.md An example HAR request to the `GET /api/v2/users` endpoint for searching a user by exact email address. This demonstrates how to structure the request with authorization headers and query parameters. ```har { "method": "GET", "url": "https://${account.namespace}/api/v2/users", "httpVersion": "HTTP/1.1", "headers": [ { "name": "Authorization", "value": "Bearer YOUR_MGMT_API_ACCESS_TOKEN" } ], "queryString": [ { "name": "q", "value": "email:\"jane@exampleco.com\"" }, { "name": "search_engine", "value": "v3" } ] } ``` -------------------------------- ### Install Auth0 SDK Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/native/_includes/_facebook_login_howto.md Instructions to install the Auth0 SDK for JavaScript. This is a prerequisite for integrating Auth0 authentication into your web application. ```bash npm install auth0-js # or yarn add auth0-js ``` -------------------------------- ### Retrieve Users with GET /api/v2/users Endpoint (HAR) Source: https://github.com/auth0/docs/blob/master/articles/users/search/v3/get-users-endpoint.md Example HAR request to the GET /api/v2/users endpoint for searching a user by exact email. This demonstrates how to authenticate and pass query parameters like 'q' and 'search_engine'. ```har { "method": "GET", "url": "https://${account.namespace}/api/v2/users", "httpVersion": "HTTP/1.1", "headers": [{ "name": "Authorization", "value": "Bearer YOUR_MGMT_API_ACCESS_TOKEN" }], "queryString": [ { "name": "q", "value": "email:\"jane@exampleco.com\"" }, { "name": "search_engine", "value": "v3" } ] } ``` -------------------------------- ### Install Nodemon for Development Source: https://github.com/auth0/docs/blob/master/articles/quickstart/spa/vanillajs/_includes/_centralized_login.md This command installs Nodemon as a development dependency. Nodemon is a utility that automatically restarts the Node.js application when file changes are detected, useful during development. ```bash npm install -D nodemon ``` -------------------------------- ### Start AD/LDAP Connector Admin UI (Bash) Source: https://github.com/auth0/docs/blob/master/articles/connector/install-other-platforms.md Starts the administrative interface for the AD/LDAP Connector. This UI is accessible via a web browser at http://localhost:8357. ```bash node admin/server.js ``` -------------------------------- ### Bash Command to Run Java Sample Application Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/java/_includes/_login.md This bash command executes the Gradle wrapper to clean the project and run the application. It's used to start the sample Java application locally for testing Auth0 integration. The output indicates the application will be accessible at http://localhost:3000/. ```bash ./gradlew clean appRun ``` -------------------------------- ### GET /api_path Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/backend/django/interactive.md This endpoint retrieves data from the specified API path. It requires an authorization header with a Bearer token. Examples are provided for PHP, Python, Ruby, and Swift. ```APIDOC ## GET /api_path ### Description This endpoint retrieves data from the specified API path. It requires an authorization header with a Bearer token. ### Method GET ### Endpoint `http:///${account.namespace}.com/api_path` ### Parameters #### Query Parameters None #### Headers - **authorization** (string) - Required - `Bearer YOUR_ACCESS_TOKEN_HERE` ### Request Example #### PHP ```php "http:///${account.namespace}.com/api_path", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "get", CURLOPT_HTTPHEADER => [ "authorization: Bearer YOUR_ACCESS_TOKEN_HERE" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:". $err; } else { echo $response; } ?> ``` #### Python ```python import http.client conn = http.client.HTTPConnection("") headers = { 'authorization': "Bearer YOUR_ACCESS_TOKEN_HERE" } conn.request("get", "/${account.namespace}.com/api_path", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` #### Ruby ```ruby require 'uri' require 'net/http' url = URI("http:///${account.namespace}.com/api_path") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["authorization"] = 'Bearer YOUR_ACCESS_TOKEN_HERE' response = http.request(request) puts response.read_body ``` #### Swift ```swift import Foundation let headers = ["authorization": "Bearer YOUR_ACCESS_TOKEN_HERE"] let request = NSMutableURLRequest(url: NSURL(string: "http:///${account.namespace}.com/api_path")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "get" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Response #### Success Response (200) - **data** (string) - The response data from the API. ``` -------------------------------- ### GET /api/public Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/backend/webapi-owin/files/ApiController.md Provides access to a public endpoint that does not require authentication. ```APIDOC ## GET /api/public ### Description This endpoint is publicly accessible and returns a greeting message. ### Method GET ### Endpoint /api/public ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Message** (string) - A greeting message from the public endpoint. #### Response Example ```json { "Message": "Hello from a public endpoint!" } ``` ``` -------------------------------- ### Install React Native Auth0 Dependency Source: https://github.com/auth0/docs/blob/master/articles/quickstart/native/react-native-expo/00-login.md Installs the React Native Auth0 module using either Yarn or npm. This is a prerequisite for integrating Auth0 authentication into your Expo application. ```bash yarn add react-native-auth0 ``` ```bash npm install react-native-auth0 --save ``` -------------------------------- ### Install Auth0 SDK for Web Applications Source: https://github.com/auth0/docs/blob/master/articles/quickstart/native/_includes/_facebook_login_howto.md This command installs the Auth0 SDK for web applications using npm. This is a prerequisite for integrating Auth0 authentication into your frontend application. ```bash npm install auth0-js --save ``` -------------------------------- ### GET /api/private Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/backend/webapi-owin/files/ApiController.md Provides access to a private endpoint that requires user authentication. ```APIDOC ## GET /api/private ### Description This endpoint is protected and requires authentication. It returns a message indicating successful access. ### Method GET ### Endpoint /api/private ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Message** (string) - A greeting message for authenticated users. #### Response Example ```json { "Message": "Hello from a private endpoint! You need to be authenticated to see this." } ``` ``` -------------------------------- ### Go Project Dependencies Management (go.mod) Source: https://github.com/auth0/docs/blob/master/articles/quickstart/webapp/golang/01-login.md Defines the project's module and lists all required dependencies for the Go application. This file ensures consistent dependency versions across different environments. ```text // go.mod module 01-Login go 1.21 require ( github.com/coreos/go-oidc/v3 v3.8.0 github.com/gin-contrib/sessions v0.0.5 github.com/gin-gonic/gin v1.9.1 github.com/joho/godotenv v1.5.1 golang.org/x/oauth2 v0.15.0 ) ``` -------------------------------- ### Start AD/LDAP Connector Server (Bash) Source: https://github.com/auth0/docs/blob/master/articles/connector/install-other-platforms.md Starts the AD/LDAP Connector server. Requires the user to input a ticket number or URL when prompted. The server will then prompt for configuration details. ```bash node server.js ``` -------------------------------- ### Signup User with cURL Source: https://github.com/auth0/docs/blob/master/articles/api/authentication/_sign-up.md Shows how to execute a signup request using the cURL command-line tool. This example includes all necessary parameters for creating a new user with optional metadata. ```shell curl --request POST \ --url 'https://${account.namespace}/dbconnections/signup' \ --header 'content-type: application/json' \ --data '{"client_id":"${account.clientId}", "email":"test.account@signup.com", "password":"PASSWORD", "connection":"CONNECTION", "username": "johndoe", "given_name": "John", "family_name": "Doe", "name": "John Doe", "nickname": "johnny", "picture": "http://example.org/jdoe.png", "user_metadata":{ "plan": "silver", "team_id": "a111" }}' ``` -------------------------------- ### Call Private API Endpoint Source: https://github.com/auth0/docs/blob/master/ja-jp/articles/quickstart/backend/aspnet-core-webapi/interactive.md Demonstrates how to make a GET request to a private API endpoint. Requires an access token for authentication. This example shows the request structure, including headers and URL. ```cURL curl --request get \ --url http://localhost:3010/api/private \ --header 'authorization: Bearer YOUR_ACCESS_TOKEN' ``` ```C# var client = new RestClient("http://localhost:3010/api/private"); var request = new RestRequest(Method.GET); request.AddHeader("authorization", "Bearer YOUR_ACCESS_TOKEN"); IRestResponse response = client.Execute(request); ``` ```Go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "http://localhost:3010/api/private" req, _ := http.NewRequest("get", url, nil) req.Header.Add("authorization", "Bearer YOUR_ACCESS_TOKEN") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```Java HttpResponse