### Install Frontegg Go SDK Source: https://developers.frontegg.com/ciam/sdks/backend/go/entitlements.md Install the Frontegg Go SDK, which includes the entitlements client, using the go get command. ```bash go get github.com/frontegg/go-sdk ``` -------------------------------- ### Install Frontegg AI SDK with npm Source: https://developers.frontegg.com/ciam/sdks/frontegg-ai/typescript.md Use npm to install the Frontegg AI SDK. Ensure you have Node.js and npm installed. ```bash npm install @frontegg/ai-sdk ``` -------------------------------- ### Install the Frontegg Entitlements SDK Source: https://developers.frontegg.com/ciam/guides/authorization/rebac.md Install the SDK using npm. This is the first step before initializing the client. ```bash npm install @frontegg/e10s-client ``` -------------------------------- ### Install @frontegg/nextjs with npm Source: https://developers.frontegg.com/ciam/sdks/frontend/next/app-router/hosted-login.md Install the Frontegg Next.js SDK using npm. ```bash npm install @frontegg/nextjs@latest ``` -------------------------------- ### Install Frontegg AI SDK Source: https://developers.frontegg.com/ciam/sdks/frontegg-ai/python.md Install the required package via pip. ```bash pip install frontegg-ai-sdk ``` -------------------------------- ### Install @frontegg/nextjs with pnpm Source: https://developers.frontegg.com/ciam/sdks/frontend/next/app-router/hosted-login.md Install the Frontegg Next.js SDK using pnpm. ```bash pnpm add @frontegg/nextjs@latest ``` -------------------------------- ### Install @frontegg/nextjs with yarn Source: https://developers.frontegg.com/ciam/sdks/frontend/next/app-router/hosted-login.md Install the Frontegg Next.js SDK using yarn. ```bash yarn add @frontegg/nextjs@latest ``` -------------------------------- ### Retrieve Tenant Metadata (GET Request) Source: https://developers.frontegg.com/ciam/guides/customizations/advanced.md This example shows how to make a GET request to retrieve tenant-specific metadata. It requires the Authorization header with a Bearer token and the `frontegg-tenant-id` header. ```http GET https://api.frontegg.com/metadata?entityName=adminBox Authorization: Bearer [VENDOR_JWT] frontegg-tenant-id: [TENANT_ID] ``` -------------------------------- ### Install Frontegg TypeScript SDK Source: https://developers.frontegg.com/ciam/api/overview.md Use this command to install the fully-typed TypeScript SDK from Frontegg's OpenAPI specification. Ensure you have Node.js and npm/npx installed. ```bash npx api install https://github.com/frontegg/openapi-public/blob/master/apis-combined.json ``` -------------------------------- ### Install Frontegg Vue library Source: https://developers.frontegg.com/ciam/sdks/frontend/vue/hosted-login.md Install the required Frontegg and router packages using npm. ```bash // for Vue.JS v3.x npm install @frontegg/vue vue-router // for Vue.JS v2.x npm install @frontegg/vue vue-router@3 ``` -------------------------------- ### Install Frontegg Next.js SDK Source: https://developers.frontegg.com/ciam/sdks/frontend/next/app-router/embedded-login.md Install the Frontegg Next.js SDK using npm, yarn, or pnpm. Ensure you are using the latest version. ```bash npm install @frontegg/nextjs@latest ``` ```bash yarn add @frontegg/nextjs@latest ``` ```bash pnpm add @frontegg/nextjs@latest ``` -------------------------------- ### Install Frontegg Node.js SDK Source: https://developers.frontegg.com/ciam/sdks/backend/node/node-integrate.md Install the Frontegg client package using npm. Ensure you are using Node.js version 22 or higher. ```bash # node 22+ npm install @frontegg/client ``` -------------------------------- ### Install Frontegg React Library (yarn) Source: https://developers.frontegg.com/ciam/sdks/frontend/react/embedded-login.md Install the Frontegg React SDK and react-router-dom using yarn. Note the specific version for react-router-dom. ```bash yarn add @frontegg/react react-router-dom@5.3.0 ``` -------------------------------- ### Install Frontegg SDK for Python Source: https://developers.frontegg.com/ciam/sdks/backend/python/flask/integrate.md Install the Frontegg SDK using pip. Ensure your Python version is 3.8 or higher. ```bash pip install frontegg ``` -------------------------------- ### Install Frontegg JS SDK via npm Source: https://developers.frontegg.com/ciam/sdks/frontend/vanilla/hosted-login.md Install the Frontegg JavaScript SDK using npm for integration into your project. ```bash npm install @frontegg/js ``` -------------------------------- ### Install Frontegg AI SDK with yarn Source: https://developers.frontegg.com/ciam/sdks/frontegg-ai/typescript.md Use yarn to add the Frontegg AI SDK to your project. Ensure you have Node.js and yarn installed. ```bash yarn add @frontegg/ai-sdk ``` -------------------------------- ### Use Frontegg TypeScript SDK to Get Roles Source: https://developers.frontegg.com/ciam/api/overview.md Example of importing and using the Frontegg SDK to fetch all roles. This snippet requires the SDK to be installed and assumes a valid Frontegg environment. ```typescript import frontegg from '@api/frontegg'; frontegg.permissionsControllerV1_getAllRoles() .then(({ data }) => console.log(data)) .catch(err => console.error(err)); ``` -------------------------------- ### Get Features Response Example Source: https://developers.frontegg.com/ciam/api/entitlements/features/featurescontrollerv1_createfeature Example JSON response structure for a successful request to retrieve a list of features. ```json { "items": [ { … } ], "hasNext": true } ``` -------------------------------- ### POST /resources/users/v1/signUp/username Source: https://developers.frontegg.com/ciam/api/identity/general/userssignupcontrollerv1_signupuserusername Sign up a new user and create a new account (tenant). Requires the frontegg-vendor-host header. ```APIDOC ## POST /resources/users/v1/signUp/username ### Description Sign up a new user and create a new account (tenant). Include the frontegg-vendor-host header (your domain name from Portal → Workspace Settings → Domains). Required fields: email, provider (authentication method: local, saml, google, github), companyName, and metadata (can be empty {}). Requires an environment authentication token. ### Method POST ### Endpoint /resources/users/v1/signUp/username ### Header Parameters - **frontegg-vendor-host** (string) - Required - Your domain name from Portal → Workspace Settings → Domains. - **frontegg-application-id** (string) - Required - The application ID. ### Request Body - **provider** (string) - Required - Enum: "local", "saml", "google", "github", "facebook", "microsoft", "scim2", "slack", "apple" - **metadata** (string) - Optional - Stringified JSON object. Use the JSON.stringify() method. - **username** (string) - Required - **name** (string) - Optional - **profilePictureUrl** (string) - Optional - **password** (string) - Optional - **skipInviteEmail** (boolean) - Optional - **roleIds** (array) - Optional - **emailMetadata** (object) - Optional - **companyName** (string) - Required - **recaptchaToken** (string) - Optional - **invitationToken** (string) - Optional - **email** (string) - Optional - **phoneNumber** (string) - Optional ### Request Example ```json { "provider": "local", "companyName": "Example Corp", "username": "testuser", "email": "test@example.com", "password": "securepassword123" } ``` ### Response #### Success Response (201) - **shouldActivate** (boolean) - Description - **userId** (string) - Description - **tenantId** (string) - Description - **authResponse** (object) - Description - **tokenType** (string) - Description - **otcToken** (string) - Description - **mfaRequired** (boolean) - Required - Description - **mfaToken** (string) - Description - **resetPasswordToken** (string) - Description - **passwordExpiresIn** (number) - Description - **notificationPeriod** (number) - Description - **mfaEnrolled** (boolean) - Description - **mfaDevices** (object) - Description - **webauthn** (array) - Required - Description - **id** (string) - Required - Description - **deviceType** (string) - Required - Enum: "Platform", "CrossPlatform" - Description - **name** (string) - Required - Description - **phones** (array) - Required - Description - **phoneNumber** (string) - Required - Description - **authenticators** (array) - Required - Description - **emails** (array) - Required - Description - **email** (string) - Required - Description - **mfaStrategies** (object) - Description - **qrCode** (string) - Description - **recoveryCode** (string) - Description - **accessToken** (string) - Required - Description - **refreshToken** (string) - Required - Description - **expiresIn** (number) - Required - Description - **expires** (string) - Required - Description - **userEmail** (string) - Description - **emailVerified** (boolean) - Description - **isBreachedPassword** (boolean) - Description - **activationToken** (string) - Description #### Response Example (201) ```json { "shouldActivate": false, "userId": "usr_12345abc", "tenantId": "ten_67890def", "authResponse": { "tokenType": "Bearer", "mfaRequired": false, "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "refreshToken": "def456ghi789jkl0mno...", "expiresIn": 3600, "expires": "2023-10-27T10:00:00.000Z", "userEmail": "test@example.com", "emailVerified": true, "isBreachedPassword": false }, "activationToken": "act_uvw123xyz456" } ``` ``` -------------------------------- ### GET User (Environment) Source: https://developers.frontegg.com/ciam/api/overview.md Example of a GET Users request using an environment JWT for management access. This requires specific Frontegg headers. ```bash --location -g --request GET 'https://api.frontegg.com/identity/resources/users/v3/me' --header 'frontegg-user-id: xxxxxxx' --header 'frontegg-tenant-id: xxxxxxx' --header 'Authorization: Bearer {{environment-JWT}}' --data-raw '' ``` -------------------------------- ### Initialize Frontegg AI Client Source: https://developers.frontegg.com/ciam/sdks/frontegg-ai/python.md Set up the client with configuration and manage user context via tenant/user IDs or JWT. ```python import asyncio import os from frontegg_ai_python_sdk import ( Environment, FronteggAiClientConfig, FronteggAiClient ) # Async usage async def async_example(): # Create client configuration config = FronteggAiClientConfig( environment=Environment.US, agent_id=os.environ.get("FRONTEGG_AGENT_ID"), client_id=os.environ.get("FRONTEGG_CLIENT_ID"), client_secret=os.environ.get("FRONTEGG_CLIENT_SECRET"), ) # Create client client = FronteggAiClient(config) # Set Context manually tenant_id = os.getenv("FRONTEGG_TENANT_ID") user_id = os.getenv("FRONTEGG_USER_ID") client.set_context(tenant_id=tenant_id, user_id=user_id) # Or set the context using the user JWT user_jwt = "Bearer eyJ..." client.set_user_context_by_jwt(user_jwt) # List available tools tools = await client.list_tools() print(f"Available tools: {tools}") # Call a tool with arguments result = await client.call_tool( name="your_tool_name", arguments={"param1": "value1"}, ) print(f"Tool result: {result}") if __name__ == "__main__": # Run async example asyncio.run(async_example()) ``` -------------------------------- ### GET User (Self-service) Source: https://developers.frontegg.com/ciam/api/overview.md Example of a GET Users request using a user JWT for self-service access. Ensure your subdomain is correctly configured. ```bash --location -g --request GET 'https://[your-subdomain].frontegg.com/identity/resources/users/v3/me' --header 'Authorization: Bearer {{user-JWT}}' --data-raw '' ``` -------------------------------- ### Create a Vue application Source: https://developers.frontegg.com/ciam/sdks/frontend/vue/hosted-login.md Initialize a new Vue project using the Vue CLI. ```bash vue create my-project cd my-project ``` -------------------------------- ### Initiate Step-Up Flow with useStepUp Hook Source: https://developers.frontegg.com/ciam/sdks/frontend/react/step-up.md Call the `useStepUp` hook to get the `stepUp` function, which can then be invoked to start the user's step-up authentication process. An optional `maxAge` parameter can be provided. ```typescript const stepUp = useStepUp(); stepUp(); // no max-age ``` ```typescript const stepUp = useStepUp(); stepUp({ maxAge: 60 * 60 }); // 1 hour ``` -------------------------------- ### Initialize Frontegg SDK with Default Client Source: https://developers.frontegg.com/ciam/sdks/backend/go/go-integrate.md Initialize the SDK once at application startup using your Frontegg workspace credentials. This sets up a default client for use with HTTP middleware. Credentials can be provided directly or via environment variables. ```go import "github.com/frontegg/go-sdk" func main() { frontegg.Init(frontegg.Credentials{ ClientID: "", APIKey: "", }) // ... } ``` -------------------------------- ### Serve Custom Overrides from a Server Source: https://developers.frontegg.com/ciam/guides/customizations/advanced.md This Node.js/Express example demonstrates how to set up a GET endpoint to serve custom theme and localization overrides. It shows how to enable CORS and send back specific overrides for the login box. ```javascript app.get("/overrides", cors(corsOptions), (req, res) => res.send({ "themeV2": { "loginBox": { "signup": { "splitFullName": true } } } }) ``` -------------------------------- ### GET /resources/account-settings/v1 Source: https://developers.frontegg.com/ciam/api/tenants.md Get account settings for a tenant. ```APIDOC ## GET /resources/account-settings/v1 ### Description Get account settings of an account (tenant). Requires a user token or vendor token. ### Method GET ### Endpoint /resources/account-settings/v1 ``` -------------------------------- ### Initialize Frontegg SDK with Explicit Client Source: https://developers.frontegg.com/ciam/sdks/backend/go/go-integrate.md Construct an explicit client for dependency injection instead of using the package-level default. This allows for more control over client instantiation. ```go client := frontegg.New(frontegg.Credentials{ ClientID: "", APIKey: "", }) identity := client.Identity() entitlements := client.Entitlements() ``` -------------------------------- ### Install Frontegg SDK Source: https://developers.frontegg.com/ciam/sdks/frontend/vanilla/embedded-login.md Add the Frontegg library to your project using npm or yarn. ```bash npm install @frontegg/js ``` ```bash yarn add @frontegg/js ``` -------------------------------- ### GET /resources/account-settings/v1/public Source: https://developers.frontegg.com/ciam/api/tenants.md Get public account settings for a tenant. ```APIDOC ## GET /resources/account-settings/v1/public ### Description Get account public settings of an account (tenant). Requires a user token or vendor token. ### Method GET ### Endpoint /resources/account-settings/v1/public ``` -------------------------------- ### Serve Application with npm Source: https://developers.frontegg.com/ciam/sdks/frontend/vue/hosted-login.md Run your Frontegg-integrated Vue.js application using npm. This command starts the development server. ```bash npm run serve ``` -------------------------------- ### GET /resources/users/bulk/v1/status/{id} Source: https://developers.frontegg.com/ciam/api/identity/users Get the status of a bulk invite task. ```APIDOC ## GET /resources/users/bulk/v1/status/{id} ### Description Get the status of a bulk invite task. ### Method GET ### Endpoint /resources/users/bulk/v1/status/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The task ID. ``` -------------------------------- ### GET /resources/v1/configurations/scim2/{id} Source: https://developers.frontegg.com/ciam/api/scim/scim-configurations Get a provisioning (SCIM) configuration by its ID. ```APIDOC ## GET /resources/v1/configurations/scim2/{id} ### Description Get a provisioning (SCIM) configuration by its ID. ### Method GET ### Endpoint /resources/v1/configurations/scim2/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the SCIM configuration. ``` -------------------------------- ### Initialize Frontegg Client and Entitlements Sub-client Source: https://developers.frontegg.com/ciam/sdks/backend/go/entitlements.md Initialize the Frontegg client with your credentials and obtain the entitlements sub-client. Reuse an existing client if initialized at application startup. ```go import "github.com/frontegg/go-sdk" client := frontegg.New(frontegg.Credentials{ ClientID: "", APIKey: "", }) ent := client.Entitlements() ``` -------------------------------- ### Full Step-Up UI Integration Example (Vanilla.js) Source: https://developers.frontegg.com/ciam/sdks/frontend/vanilla/step-up.md This example demonstrates a complete integration of Frontegg's step-up functionality within a Vanilla.js application, including conditional rendering of UI elements and event handling for the step-up button. It utilizes custom attributes like `fe-state` and `fe-action` for declarative UI management. ```html
You are STEPPED UP!
``` ```typescript const MAX_AGE = 60 * 60; //... const app = initialize({ //... }); document.querySelector('[fe-action="step-up"]').addEventListener('click', () => { app.stepUp({ maxAge: MAX_AGE }); }); app.store.subscribeStateChanged((state) => { const isAuthenticated = state.auth.isAuthenticated; let styleHtml = '' if (isAuthenticated) { styleHtml += '[fe-state="isAuthenticated"] { }'; styleHtml += '[fe-state="!isAuthenticated"] { display: none; }'; } else { styleHtml += '[fe-state="isAuthenticated"] { display: none; }'; styleHtml += '[fe-state="!isAuthenticated"] { }'; } const isUserSteppedUp = app.isSteppedUp({ maxAge: MAX_AGE }); if (isAuthenticated) { if (isUserSteppedUp) { styleHtml += '[fe-state="isSteppedUp"] { }'; styleHtml += '[fe-state="!isSteppedUp"] { display: none; }'; } else { styleHtml += '[fe-state="isSteppedUp"] { display: none; }'; styleHtml += '[fe-state="!isSteppedUp"] { }'; } } // show/hide step up button if (isAuthenticated && !isUserSteppedUp) { styleHtml += '[fe-state="canStepUp"] { }'; styleHtml += '[fe-state="!canStepUp"] { display: none; }'; } else { styleHtml += '[fe-state="canStepUp"] { display: none; }'; styleHtml += '[fe-state="!canStepUp"] { }'; } } style.innerHTML = styleHtml; }); ``` -------------------------------- ### Example Permission Keys Source: https://developers.frontegg.com/ciam/guides/authorization/rbac/permissions.md Recommended naming convention for permission keys using resource and action identifiers. ```text fe.secure.delete.samlConfiguration fe.secure.read.samlConfiguration fe.secure.write.samlConfiguration ``` -------------------------------- ### GET /resources/groups/v1 - Get all groups Source: https://developers.frontegg.com/ciam/api/identity/user-groups Retrieve all user groups for an account (tenant). ```APIDOC ## GET /resources/groups/v1 ### Description Retrieve all user groups for an account (tenant). ### Method GET ### Endpoint /resources/groups/v1 ``` -------------------------------- ### Manage tenant state and switching in Angular Source: https://developers.frontegg.com/ciam/sdks/components/tenant-functions.md Demonstrates loading tenant state and executing a tenant switch using FronteggAuthService. ```javascript import { Component, OnDestroy, OnInit } from '@angular/core'; import { Subscription } from 'rxjs'; import { FronteggAppService, FronteggAuthService, ContextHolder } from '@frontegg/angular'; import { ITeamUserRole } from '@frontegg/rest-api'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], }) export class AppComponent implements OnInit, OnDestroy { isLoading = true; loadingSubscription: Subscription; user?: any; selectedTenantId: string = ''; tenantState?: any; constructor( private fronteggAuthService: FronteggAuthService, private fronteggAppService: FronteggAppService ) { this.loadingSubscription = this.fronteggAppService.isLoading$.subscribe( (isLoading) => (this.isLoading = isLoading) ); } ngOnInit(): void { this.fronteggAuthService.teamState$.subscribe((teamState) => { const newRoles: ITeamUserRole[] = teamState.roles.filter((role: ITeamUserRole) => role.name !== 'New'); this.fronteggAuthService.setTeamState({ roles: newRoles }); }); this.fronteggAuthService.user$.subscribe((user) => { this.user = user; this.updateSelectedTenantId(); }); this.fronteggAuthService.loadTenants(); this.fronteggAuthService.tenantsState$.subscribe((tenants) => { this.tenantState = tenants; console.log('Tenant State Loaded:', this.tenantState); this.updateSelectedTenantId(); }); } private updateSelectedTenantId() { // Ensure both user and tenantState are loaded if (this.user && this.tenantState) { const activeTenant = this.tenantState.tenants.find((tenant: any) => tenant.tenantId === this.user.tenantId); if (activeTenant) { this.selectedTenantId = activeTenant.tenantId; } } } switchTenant(): void { console.log('Switching to Tenant ID:', this.selectedTenantId); // Log the tenant ID on switch this.fronteggAuthService.switchTenant({ tenantId: this.selectedTenantId }); } ngOnDestroy(): void { this.loadingSubscription.unsubscribe(); } } ``` -------------------------------- ### GET /resources/groups/v1/config - Get groups configuration Source: https://developers.frontegg.com/ciam/api/identity/user-groups Retrieve the user group configuration for your environment. ```APIDOC ## GET /resources/groups/v1/config ### Description Retrieve the user group configuration for your environment. ### Method GET ### Endpoint /resources/groups/v1/config ``` -------------------------------- ### Initialize FronteggAiClient with Logger Source: https://developers.frontegg.com/ciam/sdks/frontegg-ai/python.md Initialize the FronteggAiClient using your configuration and the previously set up custom logger. Ensure the 'config' object is defined before this step. ```python # Initialize client with logger client = FronteggAiClient(config, logger=logger) ``` -------------------------------- ### Install Frontegg Vue library with Yarn Source: https://developers.frontegg.com/ciam/sdks/frontend/vue/hosted-login.md Install the required Frontegg and router packages using yarn. ```bash // for Vue.JS v3.x yarn add @frontegg/vue vue-router // for Vue.JS v2.x yarn add @frontegg/vue vue-router@3 ``` -------------------------------- ### POST /resources/users/v1/signUp Source: https://developers.frontegg.com/ciam/api/identity.md Registers a new user and creates a new account (tenant). ```APIDOC ## POST /resources/users/v1/signUp ### Description Registers a new user and creates a new account (tenant). This endpoint supports authentication methods like local, saml, google, and github. ### Method POST ### Endpoint /resources/users/v1/signUp ### Request Body - **email** (string) - Required - User email address - **password** (string) - Required - User password - **provider** (string) - Required - Authentication provider (local, saml, google, github) - **metadata** (object) - Optional - User metadata ``` -------------------------------- ### POST /resources/users/v1/signUp Source: https://developers.frontegg.com/ciam/api/identity/general/userscontrollerv1_signupuser.md Registers a new user and creates a new account (tenant) with specified authentication provider and user details. ```APIDOC ## POST /resources/users/v1/signUp ### Description Sign up a new user and create a new account (tenant). This endpoint registers a user with authentication details and is typically used during account onboarding or self-sign-up flows. ### Method POST ### Endpoint /resources/users/v1/signUp ### Parameters #### Header Parameters - **frontegg-vendor-host** (string) - Required - The vendor host. - **frontegg-application-id** (string) - Required - The application id. #### Request Body - **provider** (string) - Required - Enum: "local", "saml", "google", "github", "facebook", "microsoft", "scim2", "slack", "apple" - **metadata** (string) - Optional - Stringified JSON object. - **email** (string) - Required - **username** (string) - Optional - **name** (string) - Optional - **profilePictureUrl** (string) - Optional - **password** (string) - Optional - **skipInviteEmail** (boolean) - Optional - **roleIds** (array) - Optional - **emailMetadata** (object) - Optional - **companyName** (string) - Required - **recaptchaToken** (string) - Optional - **invitationToken** (string) - Optional - **phoneNumber** (string) - Optional ### Response #### Success Response (201) - **provider** (string) - Required - **metadata** (string) - Optional - **email** (string) - Required - **username** (string) - Optional - **name** (string) - Optional - **profilePictureUrl** (string) - Optional - **password** (string) - Optional - **skipInviteEmail** (boolean) - Optional - **roleIds** (array) - Optional - **emailMetadata** (object) - Optional - **companyName** (string) - Required - **recaptchaToken** (string) - Optional - **invitationToken** (string) - Optional - **phoneNumber** (string) - Optional ``` -------------------------------- ### Install Frontegg React Library (npm) Source: https://developers.frontegg.com/ciam/sdks/frontend/react/embedded-login.md Install the Frontegg React SDK and react-router-dom using npm. Ensure you have the correct version of react-router-dom if you are using an existing project. ```bash npm install @frontegg/react react-router-dom ``` -------------------------------- ### Start ReBAC Engine Services Source: https://developers.frontegg.com/ciam/guides/authorization/entitlements/agent/setup.md Command to start all services defined in the docker-compose.yml file in detached mode. ```shell docker compose up -d ```