### Basic Chi Server Setup in Go Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/go/chi/_init-project.mdx A minimal Go program demonstrating how to set up a basic HTTP server using the Chi router. This example initializes a Chi router and starts listening on port 3000. ```go package main import ( "net/http" "github.com/go-chi/chi/v5" ) func main() { r := chi.NewRouter() http.ListenAndServe(":3000", r) } ``` -------------------------------- ### Initialize and Run Logto Documentation Locally Source: https://github.com/logto-io/docs.git/blob/master/README.md Commands to clone the repository, install required dependencies using PNPM, and start the development server. Prerequisites include having Git and PNPM installed on your local machine. ```bash git clone https://github.com/logto-io/docs.git cd docs pnpm install pnpm start ``` -------------------------------- ### Basic Fiber Server Setup in Go Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/go/fiber/_init-project.mdx A minimal Go program demonstrating how to create a Fiber application and start a server listening on port 3000. This serves as a starting point for building web applications with Fiber. ```go package main import ( "log" "github.com/gofiber/fiber/v2" ) func main() { app := fiber.New() log.Fatal(app.Listen(":3000")) } ``` -------------------------------- ### Initialize Slim Project Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/php/slim/README.mdx Sets up a new Slim project with necessary configurations for Logto integration. This typically involves installing dependencies and basic project structure setup. ```php 'development' )); // Add your Slim application setup here $app->run(); ?> ``` -------------------------------- ### Basic Echo Server Setup in Go Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/go/echo/_init-project.mdx A minimal Go program to create and start an Echo web server on port 3000. This serves as the foundation for building web applications with Echo. ```go package main import ( "github.com/labstack/echo/v4" ) func main() { e := echo.New() e.Logger.Fatal(e.Start(":3000")) } ``` -------------------------------- ### Install Logto SDK Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/go/_for-tutorial.mdx This snippet demonstrates the initial installation of the Logto SDK. It typically involves using a package manager like npm or yarn. Ensure you have Node.js and npm/yarn installed. ```bash npm install @logto/node # or yarn add @logto/node ``` -------------------------------- ### Manual NestJS Project Setup Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/nodejs/nestjs/_init-project.mdx Initializes a project using npm and installs the core NestJS dependencies required for a functional application. ```bash npm init -y npm install @nestjs/core @nestjs/common @nestjs/platform-express reflect-metadata rxjs ``` -------------------------------- ### Initialize API Project with Logto Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/fragments/_main-content.mdx This snippet demonstrates the initial setup for an API project to integrate with Logto. It typically involves setting up project configurations and potentially installing SDKs or dependencies. ```javascript import { LogtoConfig } from '@logto/node'; const config: LogtoConfig = { appId: 'YOUR_APP_ID', appSecret: 'YOUR_APP_SECRET', baseUrl: 'YOUR_LOGTO_BASE_URL', }; // Further initialization steps would follow here. ``` -------------------------------- ### Initialize Project for Ruby on Rails Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/ruby/rails/README.mdx Provides the necessary setup steps to initialize a new Ruby on Rails project for Logto integration. This includes installing dependencies and performing initial configuration. ```ruby # Add 'logto-ruby' gem to your Gemfile # gem 'logto-ruby' # Run bundle install # bundle install # Create an initializer file (e.g., config/initializers/logto.rb) # and add the configuration code from the 'Initialize Logto' snippet. ``` -------------------------------- ### Interactive Logto Installation (CLI) Source: https://github.com/logto-io/docs.git/blob/master/docs/logto-oss/using-cli/install-logto.mdx Run this command to start an interactive installation of Logto in your terminal. ```bash logto init ``` -------------------------------- ### Initialize Django Project and App Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/python/django/_init-project.mdx Commands to start a new Django project and create a new application within it. Assumes Python and pip are installed. ```bash django-admin startproject your_api_name cd your_api_name pip install Django python manage.py startapp api ``` -------------------------------- ### Initialize NestJS Project via CLI Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/nodejs/nestjs/_init-project.mdx Uses the Nest CLI to globally install the tool and scaffold a new project directory. This is the recommended approach for quick setup. ```bash npm i -g @nestjs/cli nest new my-api cd my-api ``` -------------------------------- ### Basic Vert.x Web Server Implementation Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/java/vertx-web/_init-project.mdx This Java code demonstrates how to create a basic Vert.x Web server. It sets up a router, defines a GET route for '/hello' that returns a plain text message, and starts the HTTP server on port 3000. This requires the vertx-web dependency. ```java package com.example; import io.vertx.core.AbstractVerticle; import io.vertx.core.Promise; import io.vertx.ext.web.Router; import io.vertx.ext.web.handler.BodyHandler; public class MainVerticle extends AbstractVerticle { @Override public void start(Promise startPromise) throws Exception { Router router = Router.router(vertx); router.route().handler(BodyHandler.create()); router.get("/hello").handler(ctx -> { ctx.response() .putHeader("content-type", "text/plain") .end("Hello from Vert.x Web!"); }); vertx.createHttpServer() .requestHandler(router) .listen(3000, http -> { if (http.succeeded()) { startPromise.complete(); System.out.println("HTTP server started on port 3000"); } else { startPromise.fail(http.cause()); } }); } } ``` -------------------------------- ### Start Slim Development Server Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/php/slim/_init-project.mdx This bash command starts a local development server using PHP's built-in web server. It serves files from the 'public' directory on localhost:8000, allowing you to test your Slim application locally without a full web server setup. Ensure you are in the project's root directory when running this command. ```bash php -S localhost:8000 -t public/ ``` -------------------------------- ### Interactive Logto Installation (npm) Source: https://github.com/logto-io/docs.git/blob/master/docs/logto-oss/using-cli/install-logto.mdx Use this npm command to initiate an interactive installation of Logto. ```bash npm init @logto@latest ``` -------------------------------- ### Install Permit.io SDK Source: https://github.com/logto-io/docs.git/blob/master/docs/integrations/authorization/permit.io/README.mdx Install the necessary Permit.io package using npm to enable authorization functionality in your application. ```bash npm install permitio ``` -------------------------------- ### Install Logto Capacitor SDK and dependencies Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/capacitor-js/_installation.mdx Use these commands to install the Logto SDK along with the necessary Capacitor peer dependencies. ```bash npm i @logto/capacitor npm i @capacitor/browser @capacitor/app @capacitor/preferences ``` ```bash yarn add @logto/capacitor yarn add @capacitor/browser @capacitor/app @capacitor/preferences ``` ```bash pnpm add @logto/capacitor pnpm add @capacitor/browser @capacitor/app @capacitor/preferences ``` -------------------------------- ### Get User Information in SvelteKit Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/sveltekit/README.mdx This example shows how to access and display user information obtained through Logto authentication within your SvelteKit components. It utilizes the `useLogto` hook to get the user object and its properties. ```javascript import { useLogto } from '@logto/svelte'; export default function UserInfo() { const { user, getAccessToken } = useLogto(); return (
{user ? (

Welcome, {user.name}!

) : (

Please log in.

)}
); } ``` -------------------------------- ### Basic Go Application with Logto SDK and Gin Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/go/_installation.md Demonstrates how to add the Logto Go SDK dependencies (`core` and `client`) to a Go application and set up a simple web server using the Gin framework. The example initializes a Gin router and defines a basic route. ```go // main.go package main import ( "github.com/gin-gonic/gin" // Add dependency "github.com/logto-io/go/v2/core" "github.com/logto-io/go/v2/client" ) func main() { router := gin.Default() router.GET("/", func(c *gin.Context) { c.String(200, "Hello Logto!") }) router.Run(":3000") } ``` -------------------------------- ### Initialize Go Project and Install Fiber Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/go/fiber/_init-project.mdx Commands to initialize a Go module and install the Fiber web framework. This sets up the project structure and fetches the necessary dependencies. ```bash go mod init your-api-name go get github.com/gofiber/fiber/v2 ``` -------------------------------- ### Initialize Go Project and Install Echo Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/go/echo/_init-project.mdx Commands to initialize a new Go module and install the Echo framework. This sets up the project structure and adds the necessary Echo library as a dependency. ```bash go mod init your-api-name go get github.com/labstack/echo/v4 ``` -------------------------------- ### Render Quick Starts Gallery Component Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/README.md This MDX snippet imports and renders the Gallery component to display available Logto quick start guides. It relies on the @components/Gallery package and uses the path property to filter relevant documentation. ```mdx import Gallery from '@components/Gallery'; ``` -------------------------------- ### Install Logto Dart SDK via pub.dev Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/flutter/_installation.mdx Install the Logto Dart SDK package using the pub package manager. This is the recommended method for most projects. It involves adding the dependency to your pubspec.yaml file and running 'flutter pub get'. ```bash flutter pub add logto_dart_sdk ``` ```yaml dependencies: logto_dart_sdk: ^3.0.0 ``` ```bash flutter pub get ``` -------------------------------- ### Initialize Go Project and Install Gin Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/go/gin/_init-project.mdx Commands to initialize a new Go module and fetch the Gin framework package. These commands are required to prepare the development environment. ```bash go mod init your-api-name go get github.com/gin-gonic/gin ``` -------------------------------- ### Get Access Token in Vue with Logto Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/vue/api-resources/code/_get-access-token-code.md This snippet shows how to use the `useLogto` hook in a Vue.js application to get an access token if the user is authenticated. It retrieves the token for a specified API resource and logs it to the console. Ensure you have `@logto/vue` installed and configured. ```typescript import { useLogto, type UserInfoResponse } from '@logto/vue'; const { isAuthenticated, getAccessToken } = useLogto(); if (isAuthenticated.value) { (async () => { const accessToken = await getAccessToken('https://shopping.your-app.com/api'); console.log(accessToken); })(); } ``` -------------------------------- ### Install Logto Go SDK Packages Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/go/_installation.md Installs the core package for predefined values and types, and the client package for interacting with Logto. These commands should be run in the project root directory. ```bash # Install the core package for accessing predefined values and types go get github.com/logto-io/go/v2/core # Install the client package for interacting with the Logto go get github.com/logto-io/go/v2/client ``` -------------------------------- ### Initialize Slim Project with Composer Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/php/slim/_init-project.mdx This snippet shows the Composer commands to create a new project directory, initialize Composer, and install the Slim Framework and its core dependencies. It requires Composer to be installed on your system. ```bash mkdir your-api-name cd your-api-name composer init composer require slim/slim:"4.*" composer require slim/psr7 composer require slim/http ``` -------------------------------- ### Build Logto Experience Project Source: https://github.com/logto-io/docs.git/blob/master/docs/customization/bring-your-ui/README.mdx Build the official Logto experience project to use as a starting point for your custom UI. This command installs dependencies and compiles the project assets. ```bash pnpm install && pnpm build ``` -------------------------------- ### Initialize Go Project and Install Chi Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/go/chi/_init-project.mdx Commands to initialize a new Go module and install the Chi router. This sets up the project structure and adds the necessary dependency for building web applications with Chi. ```bash go mod init your-api-name go get github.com/go-chi/chi/v5 ``` -------------------------------- ### Initialize Symfony Project (CLI) Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/php/symfony/_init-project.mdx Creates a new Symfony project with web application capabilities using the Symfony CLI. This is the recommended approach for quick setup. ```bash symfony new your-api-name --webapp cd your-api-name ``` -------------------------------- ### Initialize and Configure .NET Web API Project Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/dotnet/aspnet-core/_init-project.mdx Commands to create a new project, add the JWT authentication package, and start the development server. These commands are executed in the terminal. ```bash dotnet new webapi -n YourApiName cd YourApiName dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer dotnet run ``` -------------------------------- ### Create Basic Axum Application Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/rust/axum/_init-project.mdx Defines a minimal Axum application with a single GET route that responds with a JSON object. It sets up the Tokio runtime and starts a TCP listener on port 3000. ```rust use axum::{ response::Json, routing::get, Router, }; use serde_json::{json, Value}; #[tokio::main] async fn main() { let app = Router::new() .route("/", get(hello_handler)); let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); axum::serve(listener, app).await.unwrap(); } async fn hello_handler() -> Json { Json(json!({ "message": "Hello from Axum" })) } ``` -------------------------------- ### Initialize Echo Project and Dependencies Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/go/echo/README.mdx Initializes a new Go project and installs the necessary Logto authorization dependencies for the Echo framework. This is the prerequisite step before implementing middleware. ```bash go mod init my-echo-api go get github.com/labstack/echo/v4 go get github.com/logto-io/go ``` -------------------------------- ### Fetch Logto Applications using cURL Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/generic/machine-to-machine/fragments/_access-logto-management-api-using-access-token.mdx This example shows how to make a GET request to the Logto Management API to retrieve a list of applications using cURL. It requires the Logto endpoint and an Authorization header with a Bearer token. ```bash curl --location \ --request GET 'https://your.logto.endpoint/api/applications' \ --header 'Authorization: Bearer eyJhb...2g' ``` -------------------------------- ### Maven Project Setup for Vert.x Web Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/java/vertx-web/_init-project.mdx This XML file defines the Maven project structure and dependencies required for a Vert.x Web application. It includes vertx-web, vertx-auth-jwt, and vertx-web-client. Ensure you have Maven installed to manage these dependencies. ```xml 4.0.0 com.example your-api-name 1.0-SNAPSHOT 17 17 UTF-8 4.5.0 io.vertx vertx-web ${vertx.version} io.vertx vertx-auth-jwt ${vertx.version} io.vertx vertx-web-client ${vertx.version} ``` -------------------------------- ### Create Basic Rocket Application Structure Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/rust/rocket/_init-project.mdx This Rust code defines a simple Rocket application with a single GET route at the root ('/'). It returns a JSON response 'Hello from Rocket'. This serves as a minimal starting point for any Rocket web service. ```rust use rocket::{get, launch, routes, serde::json::Json}; use serde_json::{json, Value}; #[get("/")] fn hello_handler() -> Json { Json(json!({ "message": "Hello from Rocket" })) } #[launch] fn rocket() -> _ { rocket::build() .mount("/", routes![hello_handler]) } ``` -------------------------------- ### Initialize Logto Client in PHP Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/php/_for-tutorial.mdx Demonstrates how to instantiate the LogtoClient class using the required configuration object. This is the entry point for all authentication operations. ```php use Logto\Sdk\LogtoClient; use Logto\Sdk\LogtoConfig; $config = new LogtoConfig( endpoint: 'https://your-logto-endpoint', appId: 'your-app-id', appSecret: 'your-app-secret' ); $client = new LogtoClient($config, $storage); ``` -------------------------------- ### Create Basic 'Hello World' Controller (Java) Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/java/micronaut/_init-project.mdx This Java code defines a simple REST controller for a Micronaut application. It exposes a GET endpoint at '/hello' that returns the plain text 'Hello World'. This demonstrates basic controller setup and response production in Micronaut. ```java package com.example; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; import io.micronaut.http.MediaType; import io.micronaut.http.annotation.Produces; @Controller("/hello") public class HelloController { @Get @Produces(MediaType.TEXT_PLAIN) public String index() { return "Hello World"; } } ``` -------------------------------- ### Full Automation Example: Create Tenant and List Applications (Node.js) Source: https://github.com/logto-io/docs.git/blob/master/docs/logto-cloud/automate-tenant-creation.mdx A comprehensive Node.js script that automates tenant creation, exchanges default M2M credentials for a Management API access token, and lists applications in the new tenant. Ensure the LOGTO_CLOUD_PAT environment variable is set. ```javascript const cloudApiEndpoint = 'https://cloud.logto.io'; const logtoCloudPat = process.env.LOGTO_CLOUD_PAT; const createTenantResponse = await fetch(`${cloudApiEndpoint}/api/tenants`, { method: 'POST', headers: { authorization: `Bearer ${logtoCloudPat}`, 'content-type': 'application/json', }, body: JSON.stringify({ name: 'My automated tenant', tag: 'development', regionName: 'EU', }), }); if (!createTenantResponse.ok) { throw new Error(`Failed to create tenant: ${await createTenantResponse.text()}`); } const tenant = await createTenantResponse.json(); const tenantEndpoint = tenant.indicator; const { id: appId, secret: appSecret } = tenant.defaultApplication; const tokenResponse = await fetch(`${tenantEndpoint}/oidc/token`, { method: 'POST', headers: { authorization: `Basic ${Buffer.from(`${appId}:${appSecret}`).toString('base64')}`, 'content-type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams({ grant_type: 'client_credentials', resource: `${tenantEndpoint}/api`, scope: 'all', }), }); if (!tokenResponse.ok) { throw new Error(`Failed to get Management API token: ${await tokenResponse.text()}`); } const { access_token: managementApiAccessToken } = await tokenResponse.json(); const applicationsResponse = await fetch(`${tenantEndpoint}/api/applications`, { headers: { authorization: `Bearer ${managementApiAccessToken}`, }, }); if (!applicationsResponse.ok) { throw new Error(`Failed to list applications: ${await applicationsResponse.text()}`); } const applications = await applicationsResponse.json(); console.log({ tenantId: tenant.id, applications }); ``` -------------------------------- ### Validate JWT with Node.js and Express Source: https://github.com/logto-io/docs.git/blob/master/docs/integrate-logto/protected-app.mdx This Node.js example demonstrates how to verify the Logto ID Token using the 'jsonwebtoken' and 'jwks-rsa' libraries. Ensure you have these packages installed. The code sets up an Express middleware to intercept requests, extract the token, and validate its signature and issuer against your Logto domain. ```javascript const express = require('express'); const jwksClient = require('jwks-rsa'); const jwt = require('jsonwebtoken'); const ISSUER = 'https:///oidc'; const CERTS_URL = 'https:///oidc/jwks'; const client = jwksClient({ jwksUri: CERTS_URL, }); const getKey = (header, callback) => { client.getSigningKey(header.kid, function (err, key) { callback(err, key?.getPublicKey()); }); }; const verifyToken = (req, res, next) => { const token = req.headers['Logto-ID-Token']; // Make sure that the incoming request has our token header if (!token) { return res .status(403) .send({ status: false, message: 'missing required Logto-ID-Token header' }); } jwt.verify(token, getKey, { issuer: ISSUER }, (err, decoded) => { if (err) { return res.status(403).send({ status: false, message: 'invalid id token' }); } req.user = decoded; next(); }); }; const app = express(); app.use(verifyToken); app.get('/', (req, res) => { res.send('Hello World!'); }); app.listen(3000); ``` -------------------------------- ### Configuring First Screen Parameters in Logto SDK Source: https://github.com/logto-io/docs.git/blob/master/docs/end-user-flows/authentication-parameters/first-screen.mdx This JavaScript example shows how to set the `firstScreen`, `identifier`, and `loginHint` parameters when initiating the sign-in process using the Logto client SDK. This allows for programmatic control over the user's initial authentication experience. ```javascript logtoClient.signIn({ redirectUri: 'https://your-app.com/callback', firstScreen: 'identifier:register', identifier: ['email', 'phone'], loginHint: 'example@logto.io', }); ``` -------------------------------- ### Manually Fetch User Information with useLogtoClient() Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/framework/nuxt/_get-user-information.mdx This example demonstrates how to manually fetch user information using the `useLogtoClient()` composable. It highlights that the Logto client is only available on the server-side. The code shows how to get the client instance, check authentication status, and fetch user info using `client.fetchUserInfo()`, including error handling. ```typescript const client = useLogtoClient(); ``` ```typescript import { useLogtoClient, useState, callOnce } from '#imports'; const client = useLogtoClient(); const userInfo = useState(null); // Call once to prevent running from client-side await callOnce(async () => { if (!client) { throw new Error('Logto client is not available'); } if (!(await client.isAuthenticated())) { return; } try { userInfo.value = await client.fetchUserInfo(); } catch (error) { console.error('Failed to get user information:', error); } }); ``` -------------------------------- ### Create FastAPI Project Directory Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/python/fastapi/_init-project.mdx Initializes a new project by creating a directory and navigating into it. This is the first step in setting up a new FastAPI application. ```bash mkdir your-api-name cd your-api-name ``` -------------------------------- ### Install Logto SDK with Package Managers Source: https://github.com/logto-io/docs.git/blob/master/docs/quick-starts/fragments/_npm-like-installation.mdx Install the Logto SDK using your preferred Node.js package manager. This snippet includes commands for npm, pnpm, and yarn. Ensure you have Node.js and a package manager installed. ```bash npm i {props.packageName} ``` ```bash pnpm add {props.packageName} ``` ```bash yarn add {props.packageName} ``` -------------------------------- ### Initialize Permit.io Client and Sync User Source: https://github.com/logto-io/docs.git/blob/master/docs/integrations/authorization/permit.io/README.mdx Initialize the Permit.io SDK and define a helper function to sync user details and assign default roles to the Permit.io directory. ```javascript const { Permit } = require('permitio'); const permit = new Permit({ pdp: 'https://cloudpdp.api.permit.io', token: 'your-permitio-api-key', }); export const syncUserToPermit = async (userId, email, firstName, lastName, role = 'viewer') => { await permit.api.syncUser({ key: userId, email: email || undefined, first_name: firstName || undefined, last_name: lastName || undefined, }); await permit.api.assignRole({ user: userId, role: role, tenant: 'default', }); return true; }; ``` -------------------------------- ### Install PyJWT Dependency Source: https://github.com/logto-io/docs.git/blob/master/docs/authorization/validate-access-tokens/python/_add-validation-logic.mdx Installs the PyJWT library with cryptographic support required for JWT validation. ```bash pip install pyjwt[crypto] ``` -------------------------------- ### Opaque Token Response Example Source: https://github.com/logto-io/docs.git/blob/master/docs/concepts/opaque-token.mdx An example of the JSON response containing an opaque access token. ```APIDOC ## Opaque Token Response Example ### Description This is an example of the JSON response received when Logto issues an opaque access token instead of a JWT. ### Response Example ```json { "access_token": "some-random-string", // opaque token "expires_in": 3600, "id_token": "eyJhbGc...aBc", // JWT "scope": "openid profile email", "token_type": "Bearer" } ``` ``` -------------------------------- ### Initialize Quarkus Project with CLI or Maven Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/java/quarkus/_init-project.mdx Demonstrates initializing a new Quarkus project with specified extensions using the Quarkus CLI or Maven. It includes commands for project creation and navigation. Dependencies like 'resteasy-reactive' and 'smallrye-jwt' are included. ```bash quarkus create app com.example:your-api-name \ --extension='resteasy-reactive,smallrye-jwt' cd your-api-name ``` ```bash mvn io.quarkus.platform:quarkus-maven-plugin:3.6.0:create \ -DprojectGroupId=com.example \ -DprojectArtifactId=your-api-name \ -Dextensions="resteasy-reactive,smallrye-jwt" cd your-api-name ``` -------------------------------- ### Initialize Node.js Project with Hapi Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/nodejs/hapi/_init-project.mdx Commands to initialize a new Node.js project and install the Hapi framework dependency. ```bash npm init -y npm install @hapi/hapi ``` -------------------------------- ### Add an Application Payload Example Source: https://github.com/logto-io/docs.git/blob/master/docs/developers/webhooks/request.mdx Example JSON payload for adding an application to an organization via webhook. ```json { "event": "Organization.Membership.Updated", "organizationId": "org_abc", "addedApplicationIds": ["app_xyz"] } ``` -------------------------------- ### Remove a User Payload Example Source: https://github.com/logto-io/docs.git/blob/master/docs/developers/webhooks/request.mdx Example JSON payload for removing a user from an organization via webhook. ```json { "event": "Organization.Membership.Updated", "organizationId": "org_abc", "removedUserIds": ["u_001"] } ``` -------------------------------- ### Initialize a New Laravel Project Source: https://github.com/logto-io/docs.git/blob/master/docs/api-protection/php/laravel/_init-project.mdx Provides commands to scaffold a new Laravel application using either the global Laravel installer or Composer directly. These commands create the directory structure and install necessary dependencies. ```bash composer global require laravel/installer laravel new your-api-name cd your-api-name ``` ```bash composer create-project laravel/laravel your-api-name cd your-api-name ``` -------------------------------- ### Add a User Payload Example Source: https://github.com/logto-io/docs.git/blob/master/docs/developers/webhooks/request.mdx Example JSON payload for adding a user to an organization via webhook. ```json { "event": "Organization.Membership.Updated", "organizationId": "org_abc", "addedUserIds": ["u_001"] } ```