### Install dependencies and start server
Source: https://docs.kinde.com/developer-tools/sdks/backend/elixir-sdk
Run these commands in your terminal to fetch project dependencies and start your Phoenix server.
```bash
mix deps.get
mix phx.server
```
--------------------------------
### Install Go SDK
Source: https://docs.kinde.com/developer-tools/sdks/backend/go-sdk
Add the Kinde Go SDK to your project using the go get command.
```bash
go get github.com/kinde-oss/kinde-go
```
--------------------------------
### Start Development Server (bun)
Source: https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk
Start the development server using bun.
```bash
bun run dev
```
--------------------------------
### Start Development Server (npm)
Source: https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk
Start the development server using npm.
```bash
npm run dev
```
--------------------------------
### Setup Ruby and Bundler for iOS
Source: https://docs.kinde.com/developer-tools/sdks/native/react-native-sdk
Commands to install or update Bundler, initialize a Gemfile, add CocoaPods, and install dependencies using Bundler.
```shell
# Install or update Bundler
gem install bundler
# Create a new Gemfile if it doesn't exist
bundle init
# Add CocoaPods to your Gemfile
bundle add cocoapods
# Install dependencies using Bundler
bundle install
# Install pods for your project
cd ios && bundle exec pod install
```
--------------------------------
### Start Development Server (yarn)
Source: https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk
Start the development server using yarn.
```bash
yarn run dev
```
--------------------------------
### Start Development Server (pnpm)
Source: https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk
Start the development server using pnpm.
```bash
pnpm run dev
```
--------------------------------
### Install Dependencies (npm)
Source: https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk
Install the necessary dependencies for the React starter kit using npm.
```bash
cd react-starter-kit
npm install
```
--------------------------------
### Install Prisma CLI (bun)
Source: https://docs.kinde.com/workflows/workflow-tutorials/check-plan-change-eligibility
Install the Prisma ORM CLI using bun.
```bash
bun add -d prisma
```
--------------------------------
### Install Kinde SvelteKit SDK
Source: https://docs.kinde.com/developer-tools/sdks/backend/sveltekit-sdk
Install the SDK using your preferred package manager.
```bash
npm i @kinde-oss/kinde-auth-sveltekit
```
```bash
pnpm add @kinde-oss/kinde-auth-sveltekit
```
```bash
yarn add @kinde-oss/kinde-auth-sveltekit
```
```bash
bun add @kinde-oss/kinde-auth-sveltekit
```
--------------------------------
### Create API setup file
Source: https://docs.kinde.com/testing/playwright/test-backend-apis
Create the directory and the API setup file for Playwright.
```bash
mkdir tests/api
touch tests/api/api.setup.ts
```
--------------------------------
### Example Permissions Configuration
Source: https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk
An example of how permissions might be configured for a user within an organization.
```json
"permissions":[
"create:todos",
"update:todos",
"read:todos",
"delete:todos",
"create:tasks",
"update:tasks",
"read:tasks",
"delete:tasks"
]
```
--------------------------------
### Write sample Kinde API tests
Source: https://docs.kinde.com/testing/playwright/test-backend-apis
This file contains example tests for fetching user profile, validating token authorization, and updating user settings. It loads the access token from a file generated by the setup script.
```typescript
import { test, expect } from '@playwright/test'
import { readFileSync } from 'fs'
import { join } from 'path'
test.describe('Kinde API Tests', () => {
let accessToken: string
test.beforeAll(() => {
// Load access token from file created by api.setup.ts
const tokenPath = join(__dirname, '../../playwright/.auth/api-token.json')
const tokenData = JSON.parse(readFileSync(tokenPath, 'utf-8'))
accessToken = tokenData.access_token
})
test('can fetch user profile', async ({ request }) => {
const response = await request.get('/api/profile', {
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
expect(response.ok()).toBeTruthy()
const data = await response.json()
expect(data.email).toBe(process.env.TEST_USER_EMAIL)
})
test('cannot fetch user profile with invalid token', async ({ request }) => {
const response = await request.get('/api/profile', {
headers: {
Authorization: `Bearer invalid-token`,
},
})
expect(response.status()).toBe(401)
})
test('can update user settings', async ({ request }) => {
const response = await request.patch('/api/settings', {
headers: {
Authorization: `Bearer ${accessToken}`,
},
data: {
theme: 'dark',
},
})
expect(response.ok()).toBeTruthy()
})
})
```
--------------------------------
### Sign In Button Example
Source: https://docs.kinde.com/developer-tools/sdks/native/expo
An example of how to trigger the sign-in process using a Pressable component.
```typescript
Sign In
```
--------------------------------
### Install Prisma CLI (npm)
Source: https://docs.kinde.com/workflows/workflow-tutorials/check-plan-change-eligibility
Install the Prisma ORM CLI using npm.
```bash
npm i -D prisma
```
--------------------------------
### Install Prisma CLI (yarn)
Source: https://docs.kinde.com/workflows/workflow-tutorials/check-plan-change-eligibility
Install the Prisma ORM CLI using yarn.
```bash
yarn add -D prisma
```
--------------------------------
### Install React Native SDK with bun
Source: https://docs.kinde.com/developer-tools/sdks/native/react-native-sdk
Use this command to install the SDK using bun.
```shell
bun add @kinde-oss/react-native-sdk-0-7x
```
--------------------------------
### Install Required Dependencies with bun
Source: https://docs.kinde.com/developer-tools/sdks/native/react-native-sdk
Install the SDK's required dependencies using bun.
```shell
bun add react-native-app-auth react-native-keychain react-native-get-random-values
```
--------------------------------
### Install Starter Kit Dependencies
Source: https://docs.kinde.com/developer-tools/sdks/frontend/javascript-sdk
Install the necessary dependencies for the Kinde JavaScript starter kit. Navigate to the project root and run this command.
```bash
cd javascript-starter-kit
npm install
```
--------------------------------
### Get All Users
Source: https://docs.kinde.com/developer-tools/kinde-api/access-token-for-api
This example demonstrates how to make a GET request to the /users endpoint to retrieve all users, including the necessary authorization header.
```APIDOC
## GET /api/v1/users
### Description
Retrieves a list of all users.
### Method
GET
### Endpoint
https://.kinde.com/api/v1/users
### Headers
- **authorization** (string) - Required - Bearer token for authentication.
- **content-type** (string) - Required - Application JSON.
### Request Example
```json
{
"example": ""
}
```
### Response
#### Success Response (200)
- **field1** (type) - Description
#### Response Example
```json
{
"example": "response body"
}
```
```
--------------------------------
### Timezones Response Schema
Source: https://docs.kinde.com/kinde-apis/management
Example JSON response structure for the Get Timezones endpoint.
```json
{
"code": "OK",
"message": "Success",
"timezones": [
{
"key": "london_greenwich_mean_time",
"name": "London (Greenwich Mean Time) [+01:00]"
}
]
}
```
--------------------------------
### Start Development Server
Source: https://docs.kinde.com/developer-tools/sdks/frontend/javascript-sdk
Start the development server for your Kinde integrated application. Choose the command corresponding to your package manager.
```bash
npm run dev
```
```bash
pnpm run dev
```
```bash
yarn run dev
```
```bash
bun run dev
```
--------------------------------
### Industries Response Schema
Source: https://docs.kinde.com/kinde-apis/management
Example JSON response structure for the Get Industries endpoint.
```json
{
"code": "OK",
"message": "Success",
"industries": [
{
"key": "administration_office_support",
"name": "Administration & Office Support"
}
]
}
```
--------------------------------
### Complete Example with Multiple Protected Routes
Source: https://docs.kinde.com/developer-tools/sdks/frontend/react-sdk
A comprehensive example demonstrating the integration of multiple `ProtectedRoute` components for different access levels within a React application's routing setup.
```javascript
import { Routes, Route } from 'react-router-dom';
import { ProtectedRoute } from '@kinde-oss/kinde-auth-react/react-router';
function App() {
return (
} />
{/* Basic admin access */}
}
/>
{/* Premium features */}
}
/>
{/* Beta features with specific permissions */}
}
/>
);
}
```
--------------------------------
### Clone the SDK repository
Source: https://docs.kinde.com/developer-tools/sdks/backend/java-sdk
Clone the Kinde Java SDK repository from GitHub to get started.
```bash
git clone https://github.com/kinde-oss/kinde-java-sdk.git
```
--------------------------------
### Create Authentication Setup File
Source: https://docs.kinde.com/testing/playwright/test-auth-features
Create an auth.setup.ts file to handle the authentication process. This script navigates to the login page, enters credentials, and saves the authentication state.
```typescript
import { test as setup, expect } from '@playwright/test';
const authFile = 'playwright/.auth/user.json';
setup('authenticate', async ({ page, baseURL }) => {
// Navigate to your app's login page
await page.goto(baseURL!);
// Click sign in (this redirects to Kinde)
await page.click('[data-testid="sign-in-button"]');
// Wait for Kinde login page
await page.waitForURL(/.*kinde\.com.*/);
// Enter email
await page.fill('input[name="p_email"]', process.env.TEST_USER_EMAIL!);
await page.click('button[type="submit"]');
// Enter password
await page.fill('input[name="p_password"]', process.env.TEST_USER_PASSWORD!);
await page.click('button[type="submit"]');
// Wait for redirect back to your app
await page.waitForURL(new RegExp(`^${baseURL}/.*`));
// Verify authentication succeeded
await expect(page.locator('[data-testid="user-profile"]')).toBeVisible();
// Save authentication state
await page.context().storageState({ path: authFile });
});
```
--------------------------------
### Navigate to Project Directory
Source: https://docs.kinde.com/integrate/third-party-tools/kinde-supabase
Change into the newly created project directory.
```bash
cd kinde-with-supabase
```
--------------------------------
### Get Access Token using Swift
Source: https://docs.kinde.com/developer-tools/kinde-api/access-token-for-api
Example of how to obtain an access token using Swift's `URLSession`.
```APIDOC
## POST /oauth2/token (Swift)
### Description
Request an access token using client credentials in Swift.
### Method
POST
### Endpoint
`https://.kinde.com/oauth2/token`
### Parameters
#### Request Body
- **grant_type** (string) - Required - Must be `client_credentials`.
- **client_id** (string) - Required - Your M2M client ID.
- **client_secret** (string) - Required - Your M2M client secret.
- **audience** (string) - Required - The audience for the token, typically `https://.kinde.com/api`.
### Request Example
```swift
import Foundation
let headers = ["content-type": "application/x-www-form-urlencoded"]
let postData = NSMutableData(data: "grant_type=client_credentials".data(using: String.Encoding.utf8)!)
postData.append("&client_id=".data(using: String.Encoding.utf8)!)
postData.append("&client_secret=".data(using: String.Encoding.utf8)!)
postData.append("&audience=https://.kinde.com/api".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://.kinde.com/oauth2/token")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
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)
- **access_token** (string) - The JWT access token.
- **expires_in** (integer) - The token's lifetime in seconds.
- **token_type** (string) - The type of token, usually `Bearer`.
```
--------------------------------
### Get Access Token using Ruby
Source: https://docs.kinde.com/developer-tools/kinde-api/access-token-for-api
Example of how to obtain an access token using Ruby's `net/http`.
```APIDOC
## POST /oauth2/token (Ruby)
### Description
Request an access token using client credentials in Ruby.
### Method
POST
### Endpoint
`https://.kinde.com/oauth2/token`
### Parameters
#### Request Body
- **grant_type** (string) - Required - Must be `client_credentials`.
- **client_id** (string) - Required - Your M2M client ID.
- **client_secret** (string) - Required - Your M2M client secret.
- **audience** (string) - Required - The audience for the token, typically `https://.kinde.com/api`.
### Request Example
```ruby
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://.kinde.com/oauth2/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=client_credentials&client_id=&client_secret=&audience=https%3A%2F%2F.kinde.com%2Fapi"
response = http.request(request)
puts response.read_body
```
### Response
#### Success Response (200)
- **access_token** (string) - The JWT access token.
- **expires_in** (integer) - The token's lifetime in seconds.
- **token_type** (string) - The type of token, usually `Bearer`.
```
--------------------------------
### Initializing the Kinde Client
Source: https://docs.kinde.com/developer-tools/sdks/frontend/javascript-sdk
Demonstrates how to create an instance of the Kinde client with essential configuration options. This includes client ID, domain, and redirect URI. It also shows how to optionally configure `audience`, `scope`, `logout_uri`, and `is_dangerously_use_local_storage` for development.
```APIDOC
## createKindeClient
### Description
Initializes the Kinde JavaScript SDK client.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Configuration Options
- **client_id** (string) - Required - The unique ID of your application in Kinde.
- **domain** (string) - Required - Your Kinde instance URL (e.g., `https://yourapp.kinde.com`) or your custom domain.
- **redirect_uri** (string) - Required - The URL to which the user will be returned after authentication. Must match an allowed callback URL in Kinde.
- **audience** (string) - Optional - The audience claim for the JWT.
- **scope** (string) - Optional - The scopes to be requested from Kinde. Defaults to `openid profile email offline`.
- **logout_uri** (string) - Optional - The URL to redirect to after user sign-out. Defaults to `redirect_uri`.
- **is_dangerously_use_local_storage** (boolean) - Optional - For local development only. Stores the refresh token in local storage to prevent token loss on page refresh. **Not recommended for production.**
### Request Example
```javascript
const kinde = await createKindeClient({
client_id: "",
domain: "https://.kinde.com",
redirect_uri: "http://localhost:3000",
audience: "",
scope: "openid profile email offline",
logout_uri: "http://localhost:3000/logout",
is_dangerously_use_local_storage: true // Use with caution, only for local development
});
```
```
--------------------------------
### Get Access Token using Python
Source: https://docs.kinde.com/developer-tools/kinde-api/access-token-for-api
Example of how to obtain an access token using Python's `http.client`.
```APIDOC
## POST /oauth2/token (Python)
### Description
Request an access token using client credentials in Python.
### Method
POST
### Endpoint
`https://.kinde.com/oauth2/token`
### Parameters
#### Request Body
- **grant_type** (string) - Required - Must be `client_credentials`.
- **client_id** (string) - Required - Your M2M client ID.
- **client_secret** (string) - Required - Your M2M client secret.
- **audience** (string) - Required - The audience for the token, typically `https://.kinde.com/api`.
### Request Example
```python
import http.client
conn = http.client.HTTPSConnection(".kinde.com")
payload = "grant_type=client_credentials&client_id=&client_secret=&audience=https%3A%2F%2F.kinde.com%2Fapi"
headers = { 'content-type': "application/x-www-form-urlencoded" }
conn.request("POST", "/oauth2/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```
### Response
#### Success Response (200)
- **access_token** (string) - The JWT access token.
- **expires_in** (integer) - The token's lifetime in seconds.
- **token_type** (string) - The type of token, usually `Bearer`.
```
--------------------------------
### Start Development Server
Source: https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk
Commands to start the Next.js development server using different package managers.
```bash
npm run dev
```
```bash
pnpm run dev
```
```bash
yarn run dev
```
```bash
bun run dev
```
--------------------------------
### Kinde SDK Get Claim Sample Output
Source: https://docs.kinde.com/developer-tools/sdks/backend/php-sdk
Example of a retrieved claim value, such as a user's given name.
```plaintext
David
```
--------------------------------
### Install Dependencies with npm
Source: https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk
Install project dependencies using npm. This is a prerequisite for running the starter kit.
```bash
cd kinde-nextjs-app-router-starter-kit
npm install
```
--------------------------------
### Kinde SDK Get User Details Sample Output
Source: https://docs.kinde.com/developer-tools/sdks/backend/php-sdk
Example user profile details including name, ID, and email.
```php
[
"given_name" => "Dave",
"id" => "abcdef",
"family_name" => "Smith",
"email" => "mailto:dave@smith.com"
];
```
--------------------------------
### Kinde SDK Get Flag Sample Output
Source: https://docs.kinde.com/developer-tools/sdks/backend/php-sdk
Example output for a feature flag, including its code, type, value, and default status.
```php
[
"code": "is_dark_mode",
"type": "boolean",
"value": true,
"is_default": false
];
```
--------------------------------
### Example .env file values
Source: https://docs.kinde.com/developer-tools/sdks/native/flutter-sdk
Concrete example values for the .env file, demonstrating how to fill in your specific Kinde details.
```dotenv
KINDE_AUTH_DOMAIN=https://myapp.kinde.com
KINDE_AUTH_CLIENT_ID=clientid
KINDE_LOGIN_REDIRECT_URI=com.kinde.myapp://kinde_callback
KINDE_LOGOUT_REDIRECT_URI=com.kinde.myapp://kinde_logoutcallback
KINDE_AUDIENCE=myapp.kinde.com/api
```
--------------------------------
### Get Raw Access Token with useKindeBrowserClient
Source: https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk
Retrieve the raw, undecoded access token string. This is useful when you need the token as is, for example, to include in an Authorization header.
```javascript
import {useKindeBrowserClient} from "@kinde-oss/kinde-auth-nextjs";
const {accessTokenRaw, getAccessTokenRaw} = useKindeBrowserClient();
const aTokRaw = getAccessTokenRaw();
console.log(accessTokenRaw, aTokRaw);
```
--------------------------------
### Initialize Kinde Client and Configuration
Source: https://docs.kinde.com/developer-tools/sdks/backend/php-sdk
Instantiate the Kinde client and configuration objects. Ensure environment variables are set for host, redirect URL, client ID, and secret.
```php
use Kinde\KindeSDK\KindeClientSDK;
use Kinde\KindeSDK\Configuration;
use Kinde\KindeSDK\Sdk\Enums\GrantType;
...
private $kindeClient;
private $kindeConfig;
public function __construct()
{
...
$this->kindeClient = new KindeClientSDK("KINDE_HOST", "KINDE_REDIRECT_URL", "KINDE_CLIENT_ID", "KINDE_CLIENT_SECRET", "KINDE_GRANT_TYPE");
$this->kindeConfig = new Configuration();
$this->kindeConfig->setHost("KINDE_HOST");
...
}
```
--------------------------------
### Kinde SDK Get Integer Flag Sample Output
Source: https://docs.kinde.com/developer-tools/sdks/backend/php-sdk
Example output for an integer feature flag, showing its code, type, value, and default status.
```php
[
"code": "competitions_limit",
"type": "integer",
"value": 1,
"is_default": false
];
```
--------------------------------
### Kinde SDK Get String Flag Sample Output
Source: https://docs.kinde.com/developer-tools/sdks/backend/php-sdk
Example output for a string feature flag, including its code, type, value, and default status.
```php
[
"code": "theme",
"type": "string",
"value": "black",
"is_default": false
];
```
--------------------------------
### Start Prisma Studio
Source: https://docs.kinde.com/integrate/third-party-tools/kinde-nextjs-prisma
Commands to launch Prisma Studio for database management using different package managers.
```bash
npx prisma studio
```
```bash
pnpm dlx prisma studio
```
```bash
yarn dlx prisma studio
```
```bash
bunx prisma studio
```
--------------------------------
### Kinde SDK Get Boolean Flag Sample Output
Source: https://docs.kinde.com/developer-tools/sdks/backend/php-sdk
Example output for a boolean feature flag, showing its code, type, value, and default status.
```php
[
"code": "is_dark_mode",
"type": "boolean",
"value": false,
"is_default": true
];
```
--------------------------------
### Start Convex Development Server
Source: https://docs.kinde.com/integrate/third-party-tools/kinde-and-convex
Run this command to sign in to Convex and initialize a new project. Keep this terminal running for the development server.
```bash
npx convex dev
```
```bash
pnpm dlx convex dev
```
```bash
yarn dlx convex dev
```
```bash
bunx convex dev
```
--------------------------------
### Get User Organizations (React)
Source: https://docs.kinde.com/build/organizations/orgs-for-developers
A React example showing how to retrieve a list of all organization codes a user belongs to, typically from the id_token's 'org_codes' claim.
```javascript
const {getUserOrganizations} = useKindeAuth();
console.log(getUserOrganizations());
//returns {orgCodes: ["org_1234", "org_5678"]}
```
--------------------------------
### Get Organization ID (React)
Source: https://docs.kinde.com/build/organizations/orgs-for-developers
A React example demonstrating how to retrieve the current organization's ID (org_code) from the user's access token after authentication.
```javascript
const {getOrganization} = useKindeAuth();
console.log(getOrganization());
//returns {orgCode: "org_xxxxxxxxxx"}
```
--------------------------------
### Navigate to Project Directory
Source: https://docs.kinde.com/integrate/third-party-tools/kinde-nextjs-drizzle
Change into your Next.js project directory to begin.
```bash
cd my-nextjs-project
```
--------------------------------
### Workflow Runtime Log Output
Source: https://docs.kinde.com/workflows/getting-started/quick-start-guide
This is an example of the expected output in the runtime logs after a successful workflow execution. It shows the trigger, execution start, and the 'Hello world' message.
```text
Post-authentication trigger fired
Workflow found
JavaScript execution started…
Info Hello world
🎉 Workflow completed in 0.7ms
```
--------------------------------
### Initialize Prisma with SQLite (bun)
Source: https://docs.kinde.com/workflows/workflow-tutorials/check-plan-change-eligibility
Initialize Prisma with SQLite as the datasource provider using bun.
```bash
bunx prisma init --datasource-provider sqlite
```
--------------------------------
### Create Environment Variable File
Source: https://docs.kinde.com/developer-tools/sdks/frontend/javascript-sdk
Copy the example environment file to create your own. This file will store your Kinde credentials.
```bash
cp .env.example .env
```
--------------------------------
### Initialize a new Cloudflare Worker project
Source: https://docs.kinde.com/integrate/third-party-tools/verifying-jwts-cloudflare-workers
Use Wrangler to create a new Worker project. Choose the 'Hello World example' template and 'Worker Only' for a basic setup.
```bash
wrangler init my-kinde-worker
```
```bash
cd my-kinde-worker
```
```bash
touch src/helper.js
```
--------------------------------
### Install Kinde SDK with bun
Source: https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk
Install the Kinde authentication Next.js SDK using bun for an existing project.
```bash
bun add @kinde-oss/kinde-auth-nextjs
```
--------------------------------
### Get API keys
Source: https://docs.kinde.com/kinde-apis/management
Returns a list of API keys. Supports filtering by page size, starting point, key type, status, user ID, and organization code.
```APIDOC
## GET /api/v1/api_keys
### Description
Returns a list of API keys. Supports filtering by page size, starting point, key type, status, user ID, and organization code.
### Method
GET
### Endpoint
/api/v1/api_keys
### Query Parameters
- **page_size** (integer, nullable) - Number of results per page. Defaults to 50 if parameter not sent.
- **starting_after** (string, nullable) - The ID of the API key to start after.
- **key_type** (string, nullable, enum: organization, user) - Filter by API key type.
- **status** (string, nullable, enum: active, inactive, revoked) - Filter by API key status.
- **user_id** (string, nullable) - Filter by user ID to get API keys associated with a specific user.
- **org_code** (string, nullable) - Filter by organization code to get API keys associated with a specific organization.
### Responses
#### Success Response (200)
API keys successfully retrieved.
- **code** (string) - OK
- **message** (string) - Success
- **has_more** (boolean) - Indicates if there are more results.
- **api_keys** (array) - List of API key objects.
- **id** (string) - The unique identifier for the API key.
- **name** (string) - The name of the API key.
- **type** (string) - The type of the API key (organization or user).
- **status** (string) - The status of the API key (active, inactive, revoked).
- **key_prefix** (string) - The prefix of the API key.
- **key_suffix** (string) - The suffix of the API key.
- **created_on** (string) - The date and time the API key was created.
- **last_verified_on** (string) - The date and time the API key was last verified.
- **last_verified_ip** (string) - The IP address from which the API key was last verified.
- **created_by** (string) - The user who created the API key.
- **api_ids** (array of strings) - List of associated API IDs.
- **scopes** (array of strings) - List of associated scopes.
#### Error Responses
- **400** - Invalid request.
- **403** - Unauthorized - invalid credentials.
- **429** - Too many requests. Request was throttled.
### Request Example
```curl
curl --request GET \
--url https://your_kinde_subdomain.kinde.com/api/v1/api_keys \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
```
```
--------------------------------
### CI/CD Playwright API Tests Setup
Source: https://docs.kinde.com/testing/playwright/test-backend-apis
Configure GitHub Actions to install dependencies, Playwright browsers, and run API tests using environment variables for sensitive credentials.
```yaml
name: API Tests
on:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Run Playwright API tests
run: npx playwright test --project=api-tests
env:
KINDE_ISSUER_URL: ${{ secrets.KINDE_ISSUER_URL }}
KINDE_CLIENT_ID: ${{ secrets.KINDE_CLIENT_ID }}
TEST_APP_URL: ${{ secrets.TEST_APP_URL }}
TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}
KINDE_REFRESH_TOKEN: ${{ secrets.KINDE_REFRESH_TOKEN }}
```
--------------------------------
### Create an application using the Management API
Source: https://docs.kinde.com/developer-tools/sdks/backend/go-sdk
Example of how to programmatically create a new application within your Kinde tenant.
```go
res, err := managementApi.CreateApplication(ctx, &management_api.CreateApplicationReq{
Name: "Backend app",
Type: management_api.CreateApplicationReqTypeReg,
})
if err != nil {
// handle error
}
```
--------------------------------
### Kinde API Tests with Cypress
Source: https://docs.kinde.com/testing/cypress/test-backend-apis
Example Cypress tests for Kinde API endpoints. Includes setup for authentication, fetching user profile, and updating user settings. Ensure environment variables are configured.
```javascript
describe('Kinde API Tests', () => {
let accessToken
before(() => {
// Load access token from file, or refresh if file doesn't exist
cy.task('readApiToken').then((tokenData) => {
if (!tokenData) {
// Token file doesn't exist, refresh tokens first
return cy.task('refreshApiTokens', {
issuerUrl: Cypress.env('KINDE_ISSUER_URL'),
clientId: Cypress.env('KINDE_CLIENT_ID'),
refreshToken: Cypress.env('KINDE_REFRESH_TOKEN'),
}).then(() => {
return cy.task('readApiToken')
})
}
return tokenData
}).then((tokenData) => {
accessToken = tokenData.access_token
})
})
it('can fetch user profile', () => {
cy.request({
url: `${Cypress.env('TEST_APP_URL')}/api/profile`,
headers: {
Authorization: `Bearer ${accessToken}`,
},
}).then((response) => {
expect(response.status).to.eq(200)
expect(response.body.email).to.eq(Cypress.env('TEST_USER_EMAIL'))
})
})
it('cannot fetch user profile with invalid token', () => {
cy.request({
url: `${Cypress.env('TEST_APP_URL')}/api/profile`,
headers: {
Authorization: `Bearer invalid-token`,
},
failOnStatusCode: false,
}).then((response) => {
expect(response.status).to.eq(401)
})
})
it('can update user settings', () => {
cy.request({
method: 'PATCH',
url: `${Cypress.env('TEST_APP_URL')}/api/settings`,
headers: {
Authorization: `Bearer ${accessToken}`,
},
body: {
theme: 'dark',
},
}).then((response) => {
expect(response.status).to.eq(200)
})
})
})
```
--------------------------------
### Handle Redirect and Get Token
Source: https://docs.kinde.com/developer-tools/sdks/native/ios-sdk
Once the user is redirected back to your site from Kinde after successful login, use the `getToken` method to retrieve a user token. This example demonstrates handling the login result and asynchronously fetching the token.
```APIDOC
## Handle redirect
Once your user is redirected back to your site from Kinde (it means you’ve logged in successfully), use the `getToken` method from `KindeSDKAPI` class to get a user token from Kinde.
Let’s look at an example of successful login.
```swift
KindeSDKAPI.auth.login { result in
switch result {
case let .failure(error):
if !KindeSDKAPI.auth.isUserCancellationErrorCode(error) {
self.alert("Login failed: \(error.localizedDescription)")
}
case .success:
self.onLoggedIn() // Calling this function
}
}
func onLoggedIn() {
self.isAuthenticated = true
self.getToken()
}
private func getToken() {
Task {
await asyncGetToken()
}
}
private func asyncGetToken() async -> String {
do {
let token = try await KindeSDKAPI.auth.getToken()
return token
} catch {
return ""
}
}
```
```
--------------------------------
### Electron Main Process Setup with Kinde Integration
Source: https://docs.kinde.com/developer-tools/guides/kinde-and-electron
Sets up the main process for an Electron app, including environment configuration, Kinde authentication constants, token storage, and helper functions for OAuth.
```javascript
require("dotenv").config()
const { app, BrowserWindow, ipcMain, shell } = require("electron")
const path = require("path")
const os = require("os")
const express = require("express")
const keytar = require("keytar")
const {
generateVerifier,
challengeFromVerifier,
randomState,
decodeIdToken,
createTokenStore,
} = require("./helpers")
// ---------- Config ----------
const CALLBACK_HOST = "127.0.0.1"
const CALLBACK_PORT = 53180
const REDIRECT_URI = `http://${CALLBACK_HOST}:${CALLBACK_PORT}/callback`
const ISSUER = process.env.KINDE_ISSUER_URL
const CLIENT_ID = process.env.KINDE_CLIENT_ID
const AUDIENCE = process.env.KINDE_AUDIENCE || ""
const SCOPES = (
process.env.KINDE_SCOPES || "openid profile email offline"
).trim()
if (!ISSUER || !CLIENT_ID) {
console.error("Please configure KINDE_ISSUER_URL and KINDE_CLIENT_ID in .env")
}
const tokenStore = createTokenStore(keytar, {
serviceName: "electron-kinde-pkce-sample",
accountName: os.userInfo().username, // or 'default'
})
// Ensure we have a fetch impl (Electron/Node 18+ has global fetch)
const fetchFn =
global.fetch ||
((...args) => import("node-fetch").then(({ default: f }) => f(...args)))
// ---------- Small helpers ----------
function stampIssued(tokens) {
const t = { ...tokens }
t.issued_at = Date.now()
if (typeof t.expires_in === "number")
t.expires_at = t.issued_at + t.expires_in * 1000
return t
}
async function postForm(url, data) {
const body = new URLSearchParams(data)
const res = await fetchFn(url, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body,
})
const text = await res.text()
if (!res.ok) throw new Error(`${res.status} ${text}`)
return JSON.parse(text)
}
// ---------- OAuth helpers ----------
async function exchangeCodeForTokens({ code, codeVerifier, redirectUri }) {
const tokenUrl = new URL("/oauth2/token", ISSUER).toString()
const json = await postForm(tokenUrl, {
grant_type: "authorization_code",
code,
client_id: CLIENT_ID,
redirect_uri: redirectUri,
code_verifier: codeVerifier,
})
return stampIssued(json)
}
async function refreshTokens(refreshToken) {
const tokenUrl = new URL("/oauth2/token", ISSUER).toString()
const json = await postForm(tokenUrl, {
grant_type: "refresh_token",
refresh_token: refreshToken,
client_id: CLIENT_ID,
})
// Some providers omit refresh_token on refresh → keep the old one
if (!json.refresh_token) json.refresh_token = refreshToken
return stampIssued(json)
}
async function getValidAccessToken() {
const tokens = await tokenStore.load()
if (!tokens) return null
const expiresAt =
tokens.expires_at ??
(tokens.issued_at || 0) + (tokens.expires_in || 0) * 1000
```
--------------------------------
### Get Access Token using Node.js (fetch)
Source: https://docs.kinde.com/developer-tools/kinde-api/access-token-for-api
This Node.js example uses the fetch API to make a POST request to the Kinde token endpoint. It demonstrates how to construct the request body using URLSearchParams and handle the response.
```javascript
async function getToken() {
try {
const response = await fetch(`https://.kinde.com/oauth2/token`, {
method: "POST",
headers: {
"content-type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams({
audience: "https://.kinde.com/api",
grant_type: "client_credentials",
client_id: "",
client_secret: ""
})
});
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}
const json = await response.json();
console.log(json);
} catch (error) {
console.error(error.message);
}
}
getToken();
```
--------------------------------
### Run Prisma Database Migration (bun)
Source: https://docs.kinde.com/workflows/workflow-tutorials/check-plan-change-eligibility
Applies database migrations to initialize the database schema using Prisma and bun.
```bash
bunx prisma migrate dev --name init
```
--------------------------------
### Configure PKCE for Public Clients
Source: https://docs.kinde.com/developer-tools/sdks/backend/go-sdk
Enable PKCE (Proof Key for Code Exchange) for public clients by passing an empty string for the client secret and using `WithPKCE()` or `WithPKCEChallengeMethod()`.
```go
authorization_code.WithPKCE() // SHA256 (S256) challenge method
authorization_code.WithPKCEChallengeMethod("plain") // custom challenge method
```
--------------------------------
### Get Feature Flag Theme with OAuth Client
Source: https://docs.kinde.com/developer-tools/sdks/backend/python-sdk
Access feature flags, such as 'theme', using the OAuth client in a framework-based application like Flask. This example demonstrates fetching a flag value asynchronously and handling a default value if the flag is not found.
```python
from kinde_sdk.auth.oauth import OAuth
from flask import request
import asyncio
oauth = OAuth(framework="flask", app=app)
# Async pattern (required for OAuth client)
def get_theme_sync():
loop = asyncio.get_event_loop()
theme_flag = loop.run_until_complete(
oauth.get_flag("theme", request, default_value="light")
)
return theme_flag.value
```
--------------------------------
### Permission Check in FastAPI (OAuth Client)
Source: https://docs.kinde.com/developer-tools/sdks/backend/python-sdk
Integrate permission checks directly into FastAPI routes using the OAuth client. Ensure `kinde_sdk.auth.oauth` is imported and the client is initialized with framework and app details. This example shows checking permissions for POST and GET requests.
```python
from fastapi import FastAPI, Request, HTTPException
from kinde_sdk.auth.oauth import OAuth
app = FastAPI()
oauth = OAuth(framework="fastapi", app=app)
@app.post("/todos")
async def create_todo(request: Request, todo_data: dict):
permission = await oauth.get_permission("create:todos", request)
if not permission["isGranted"]:
raise HTTPException(status_code=403, detail="Permission denied")
# Create todo logic here...
return {"message": "Todo created"}
@app.get("/todos")
async def list_todos(request: Request):
permission = await oauth.get_permission("read:todos", request)
if not permission["isGranted"]:
raise HTTPException(status_code=403, detail="Permission denied")
# List todos logic...
return {"todos": []}
```
--------------------------------
### Install CocoaPods and Pods for iOS
Source: https://docs.kinde.com/developer-tools/sdks/native/react-native-sdk
Install CocoaPods using Homebrew and then install pods for your iOS project.
```shell
brew install cocoapods
cd ios && pod install
```
--------------------------------
### Client Initialization and Basic Usage
Source: https://docs.kinde.com/developer-tools/sdks/backend/ruby-sdk
Demonstrates how to initialize the Kinde SDK client and access various API modules for common operations.
```APIDOC
## Client Usage
The API part is mounted in the `KindeSdk::Client` instance. Here's a short usage example:
```ruby
client = KindeSdk::Client.new(session[:kinde_auth])
# Accessing user information
client.oauth.get_user
# Creating a user
client.users.create_user(args)
# Retrieving organizations
client.organizations.get_organizations
```
Alternatively, you can initialize each API module separately:
```ruby
api_client = KindeSdk.api_client(access_token)
instance_client = KindeApi::UsersApi.new(api_client)
instance_client.create_user(args)
```
```
--------------------------------
### Install JWT Types Dependency
Source: https://docs.kinde.com/integrate/third-party-tools/kinde-supabase
Install the development types for jsonwebtoken.
```bash
npm i -D @types/jsonwebtoken
```
```bash
pnpm add -D @types/jsonwebtoken
```
```bash
yarn add -D @types/jsonwebtoken
```
```bash
bun add -d @types/jsonwebtoken
```
--------------------------------
### Open Cypress configuration wizard with bun
Source: https://docs.kinde.com/testing/cypress
Launch the Cypress configuration wizard to set up end-to-end testing using bun.
```bash
bunx cypress open
```
--------------------------------
### Initialize Prisma Project with SQLite
Source: https://docs.kinde.com/integrate/third-party-tools/kinde-nextjs-prisma
Initialize your Prisma project using SQLite as the database provider.
```bash
npx prisma init --datasource-provider sqlite
```
```bash
pnpm dlx prisma init --datasource-provider sqlite
```
```bash
yarn dlx prisma init --datasource-provider sqlite
```
```bash
bunx prisma init --datasource-provider sqlite
```