docs: add initial docs for the new client-libraries (#10230)

# Which Problems Are Solved

The recently released client libraries were missing documentation, which
made it difficult for developers to understand and use the new features.

# How the Problems Are Solved

This pull request introduces the necessary documentation for the new
client libraries, covering their installation and basic usage.

# Additional Changes

None.

# Additional Context

This documentation supports the recent client library release.
This commit is contained in:
Mridang Agarwalla
2025-07-21 12:32:00 +05:30
committed by GitHub
parent 25adfd91a2
commit 63b894908c
24 changed files with 2028 additions and 350 deletions
+10 -6
View File
@@ -3,12 +3,16 @@ title: ZITADEL with Go
sidebar_label: Go
---
This integration guide demonstrates the recommended way to incorporate ZITADEL into your Go web application.
This integration guide demonstrates the recommended way to incorporate ZITADEL into your Go web application.
It explains how to enable user login in your application and how to fetch data from the user info endpoint.
> ℹ️ These examples and guides are based on our official [Go SDK](https://github.com/zitadel/zitadel-go).
>
> The SDK is a convenient wrapper around our low-level [OIDC library](https://github.com/zitadel/oidc). For most use cases, using the helpers provided in our [Go SDK](https://github.com/zitadel/zitadel-go) is the recommended approach for implementing authentication.
By the end of this guide, your application will have login functionality and will be able to access the current user's profile.
> This documentation references our [example](https://github.com/zitadel/zitadel-go) on GitHub.
> This documentation references our [example](https://github.com/zitadel/zitadel-go) on GitHub.
> You can either create your own application or directly run the example by providing the necessary arguments.
## Set up application
@@ -86,7 +90,7 @@ To ensure the user is authenticated before they are able to use your application
```go
mw.CheckAuthentication()(handler)
```
***Authentication context***
If you used either of the authentication checks above, you can then access context information in your handler:
@@ -119,7 +123,7 @@ https://github.com/zitadel/zitadel-go/blob/next/example/app/templates/profile.ht
You will need to provide some values for the program to run:
- `domain`: Your ZITADEL instance domain, e.g. my-domain.zitadel.cloud
- `key`: Random secret string. Used for symmetric encryption of state parameters, cookies and PCKE.
- `key`: Random secret string. Used for symmetric encryption of state parameters, cookies and PCKE.
- `clientID`: The clientID provided by ZITADEL
- `redirectURI`: The redirectURI registered at ZITADEL
- `port`: The port on which the API will be accessible, default it 8089
@@ -146,7 +150,7 @@ By clicking on `Login` you will be redirected to your ZITADEL instance. After lo
Congratulations! You have successfully integrated your Go application with ZITADEL!
If you get stuck, consider checking out our [example](https://github.com/zitadel/zitadel-go) application.
This application includes all the functionalities mentioned in this quickstart.
If you get stuck, consider checking out our [example](https://github.com/zitadel/zitadel-go) application.
This application includes all the functionalities mentioned in this quickstart.
You can directly start it with your own configuration. If you face issues, contact us or raise an issue on [GitHub](https://github.com/zitadel/zitadel-go/issues).
+6 -2
View File
@@ -6,13 +6,17 @@ sidebar_label: Go
This integration guide shows you how to integrate **ZITADEL** into your Go API. It demonstrates how to secure your API using
OAuth 2 Token Introspection.
> ℹ️ These examples and guides are based on our official [Go SDK](https://github.com/zitadel/zitadel-go).
>
> The SDK is a convenient wrapper around our low-level [OIDC library](https://github.com/zitadel/oidc). For most use cases, using the helpers provided in our [Go SDK](https://github.com/zitadel/zitadel-go) is the recommended approach for implementing authentication.
At the end of the guide you should have an API with a protected endpoint.
> This documentation references our HTTP example. There's also one for GRPC. Check them out on [GitHub](https://github.com/zitadel/zitadel-go/blob/next/example/api/http/main.go).
## Prerequisites
This will handle the OAuth 2.0 introspection request including authentication using JWT with Private Key using our [OIDC client library](https://github.com/zitadel/oidc).
This will handle the OAuth 2.0 introspection request including authentication using JWT with Private Key using our [Go SDK](https://github.com/zitadel/zitadel-go).
All that is required, is to create your API, create a private key and a personal access token for a service user.
### Set up application and obtain keys
@@ -125,7 +129,7 @@ Now you can call the API by browser or curl. Try the healthz endpoint first:
curl -i http://localhost:8089/api/healthz
```
it should return something like:
it should return something like:
```
HTTP/1.1 200 OK
@@ -6,13 +6,17 @@ sidebar_label: Example Go
This integration guide shows you how to integrate **ZITADEL** into your Go application.
It demonstrates how to fetch some data from the ZITADEL management API.
> ℹ️ These examples and guides are based on our official [Go SDK](https://github.com/zitadel/zitadel-go).
>
> The SDK is a convenient wrapper around our low-level [OIDC library](https://github.com/zitadel/oidc). For most use cases, using the helpers provided in our [Go SDK](https://github.com/zitadel/zitadel-go) is the recommended approach for implementing authentication.
At the end of the guide you should have an application able to read the details of your organization.
> This documentation references our [CLI example](https://github.com/zitadel/zitadel-go/blob/next/example/client/cli/cli.go).
## Prerequisites
The client [SDK](https://github.com/zitadel/zitadel-go) will handle all necessary OAuth 2.0 requests and send the required headers to the ZITADEL API using our [OIDC client library](https://github.com/zitadel/oidc).
The client [SDK](https://github.com/zitadel/zitadel-go) will handle all necessary OAuth 2.0 requests and send the required headers to the ZITADEL API using our [Go SDK](https://github.com/zitadel/zitadel-go).
All that is required, is a service account with an Org Owner (or another role, depending on the needed api requests) role assigned and its key JSON.
However, we recommend you read the guide on [how to access ZITADEL API](/docs/guides/integrate/zitadel-apis/access-zitadel-apis)) and the associated guides for a basic knowledge of :
@@ -64,7 +68,7 @@ This will output something similar to:
You have successfully used the ZITADEL Go SDK to call the management API!
If you encountered an error (e.g. `code = PermissionDenied desc = No matching permissions found`),
If you encountered an error (e.g. `code = PermissionDenied desc = No matching permissions found`),
ensure your service user has the required permissions by assigning the `ORG_OWNER` or `ORG_OWNER_VIEWER` role
and check the mentioned [guides](#prerequisites) at the beginning.
@@ -0,0 +1,4 @@
{
"label": "Client Libraries",
"position": 2
}
@@ -0,0 +1,194 @@
---
title: Java Client
sidebar_label: 'Java Client'
---
<table>
<tr>
<td width="100px">
<img width="100px" src="/docs/img/tech/java.svg" alt="java logo"/>
</td>
<td>
This guide covers the official Zitadel Management API Client for the JVM (Java 11+), which allows you to programmatically manage resources in your Zitadel instance.
</td>
</tr>
</table>
:::info
**This is a Management API Client, not an Authentication SDK.**
This library is designed for server-to-server communication to manage your Zitadel instance (e.g., creating users, managing projects, and updating settings). It is **not** intended for handling end-user login flows in your web application. For user authentication, you should use a standard OIDC library like Spring Security.
:::
The Zitadel Java Client provides an idiomatic way to access the full gamut of Zitadel's v2 Management APIs from your JVM-based backend applications.
> Please be aware that this client library is currently in an **incubating stage**.
While it is available for use, the API and its functionality may evolve, potentially introducing
breaking changes in future updates. We advise caution when considering it for production environments.
### Installation
You can add the client library to your project using Maven by adding the following dependency to your `pom.xml` :
```xml
<dependency>
<groupId>io.github.zitadel</groupId>
<artifactId>client</artifactId>
<version>4.0.0-beta-1</version>
</dependency>
```
### Using the SDK
Your SDK offers three ways to authenticate with Zitadel. Each method has its
own benefits—choose the one that fits your situation best.
#### 1. Private Key JWT Authentication
**What is it?**
You use a JSON Web Token (JWT) that you sign with a private key stored in a
JSON file. This process creates a secure token.
**When should you use it?**
- **Best for production:** It offers strong security.
- **Advanced control:** You can adjust token settings like expiration.
**How do you use it?**
1. Save your private key in a JSON file.
2. Build the authenticator using the helper method.
**Example:**
```java
import com.zitadel.ApiException;
import com.zitadel.Zitadel;
import com.zitadel.model.UserServiceAddHumanUserRequest;
import com.zitadel.model.UserServiceAddHumanUserResponse;
import com.zitadel.model.UserServiceSetHumanEmail;
import com.zitadel.model.UserServiceSetHumanProfile;
class Demo {
public static void main(String[] args) throws ApiException {
Zitadel zitadel = Zitadel.withPrivateKey("https://example.us1.zitadel.cloud", "path/to/jwt-key.json");
UserServiceAddHumanUserResponse response = zitadel.users.userServiceAddHumanUser(
new UserServiceAddHumanUserRequest()
.username("john.doe")
.profile(new UserServiceSetHumanProfile()
.givenName("John")
.familyName("Doe"))
.email(new UserServiceSetHumanEmail()
.email("[email protected]"))
);
System.out.println("User created: " + response);
}
}
```
#### 2. Client Credentials Grant
**What is it?**
This method uses a client ID and client secret to get a secure access token,
which is then used to authenticate.
**When should you use it?**
- **Simple and straightforward:** Good for server-to-server communication.
- **Trusted environments:** Use it when both servers are owned or trusted.
**How do you use it?**
1. Provide your client ID and client secret.
2. Build the authenticator using the helper method.
**Example:**
```java
import com.zitadel.ApiException;
import com.zitadel.Zitadel;
import com.zitadel.model.UserServiceAddHumanUserRequest;
import com.zitadel.model.UserServiceAddHumanUserResponse;
import com.zitadel.model.UserServiceSetHumanEmail;
import com.zitadel.model.UserServiceSetHumanProfile;
class Demo {
public static void main(String[] args) throws ApiException {
Zitadel zitadel = Zitadel.withClientCredentials("https://example.us1.zitadel.cloud", "id", "secret");
UserServiceAddHumanUserResponse response = zitadel.users.addHumanUser(
new UserServiceAddHumanUserRequest()
.username("john.doe")
.profile(new UserServiceSetHumanProfile()
.givenName("John")
.familyName("Doe"))
.email(new UserServiceSetHumanEmail()
.email("[email protected]"))
);
System.out.println("User created: " + response);
}
}
```
#### 3. Personal Access Tokens (PATs)
**What is it?**
A Personal Access Token (PAT) is a pre-generated token that you can use to
authenticate without exchanging credentials every time.
**When should you use it?**
- **Easy to use:** Great for development or testing scenarios.
- **Quick setup:** No need for dynamic token generation.
**How do you use it?**
1. Obtain a valid personal access token from your account.
2. Build the authenticator using the helper method.
**Example:**
```java
import com.zitadel.ApiException;
import com.zitadel.Zitadel;
import com.zitadel.model.UserServiceAddHumanUserRequest;
import com.zitadel.model.UserServiceAddHumanUserResponse;
import com.zitadel.model.UserServiceSetHumanEmail;
import com.zitadel.model.UserServiceSetHumanProfile;
class Demo {
public static void main(String[] args) throws ApiException {
Zitadel zitadel = Zitadel.withAccessToken("https://example.us1.zitadel.cloud", "token");
UserServiceAddHumanUserResponse response = zitadel.users.addHumanUser(
new UserServiceAddHumanUserRequest()
.username("john.doe")
.profile(new UserServiceSetHumanProfile()
.givenName("John")
.familyName("Doe"))
.email(new UserServiceSetHumanEmail()
.email("[email protected]"))
);
System.out.println("User created: " + response);
}
}
```
---
Choose the authentication method that best suits your needs based on your
environment and security requirements. For more details, please refer to the
[Zitadel documentation on authenticating service users](https://zitadel.com/docs/guides/integrate/service-users/authenticate-service-users).
### Versioning
The client library's versioning is aligned with the Zitadel core project. The major version of the
client corresponds to the major version of Zitadel it is designed to work with. For example,
v2.x.x of the client is built for and tested against Zitadel v2, ensuring a predictable and stable integration.
### Resources
- [GitHub Repository](https://github.com/zitadel/client-java): For source code, examples, and to report issues.
- [Maven Package](https://central.sonatype.com/artifact/io.github.zitadel/client): The official package artifact for Maven.
@@ -0,0 +1,193 @@
---
title: PHP Client
sidebar_label: 'PHP Client'
---
<table>
<tr>
<td width="100px">
<img width="100px" src="/docs/img/tech/php.svg" alt="php logo"/>
</td>
<td>
This guide covers the official Zitadel Management API Client for PHP, which allows you to programmatically manage resources in your Zitadel instance.
</td>
</tr>
</table>
:::info
**This is a Management API Client, not an Authentication SDK.**
This library is designed for server-to-server communication to manage your Zitadel instance (e.g., creating users, managing projects, and updating settings). It is **not** intended for handling end-user login flows in your web application. For user authentication, you should use a standard OIDC library with your PHP framework of choice.
:::
The Zitadel PHP Client provides an idiomatic way to access the full gamut of
Zitadel's v2 Management APIs from your PHP backend.
> Please be aware that this client library is currently in an **incubating stage**.
While it is available for use, the API and its functionality may evolve, potentially introducing
breaking changes in future updates. We advise caution when considering it for production environments.
### Installation
You can add the client library to your project using Composer:
```bash
composer require zitadel/client:"^4.0.0-beta1"
```
### Using the SDK
Your SDK offers three ways to authenticate with Zitadel. Each method has its
own benefits—choose the one that fits your situation best.
#### 1. Private Key JWT Authentication
**What is it?**
You use a JSON Web Token (JWT) that you sign with a private key stored in a
JSON file. This process creates a secure token.
**When should you use it?**
- **Best for production:** It offers strong security.
- **Advanced control:** You can adjust token settings like expiration.
**How do you use it?**
1. Save your private key in a JSON file.
2. Use the provided method to load this key and create a JWT-based
authenticator.
**Example:**
```php
use \Zitadel\Client\Zitadel;
$zitadel = Zitadel::withPrivateKey("https://example.us1.zitadel.cloud", "path/to/jwt-key.json");
try {
$response = $zitadel->users->userServiceAddHumanUser([
'username' => 'john.doe',
'profile' => [
'givenName' => 'John',
'familyName' => 'Doe'
],
'email' => [
'email' => '[email protected]'
]
]);
echo "User created: " . print_r($response, true);
} catch (ApiException $e) {
echo "Error: " . $e->getMessage();
}
```
#### 2. Client Credentials Grant
**What is it?**
This method uses a client ID and client secret to get a secure access token,
which is then used to authenticate.
**When should you use it?**
- **Simple and straightforward:** Good for server-to-server communication.
- **Trusted environments:** Use it when both servers are owned or trusted.
**How do you use it?**
1. Provide your client ID and client secret.
2. Build the authenticator
**Example:**
```php
use Zitadel\Client\Zitadel;
use Zitadel\Client\Model\UserServiceAddHumanUserRequest;
use \Zitadel\Client\Model\UserServiceAddHumanUserRequest;
use \Zitadel\Client\Model\UserServiceSetHumanProfile;
use \Zitadel\Client\Model\UserServiceSetHumanEmail;
$zitadel = Zitadel::withClientCredentials("https://example.us1.zitadel.cloud", "id", "secret");
try {
$response = $zitadel->users->addHumanUser((new UserServiceAddHumanUserRequest())
->setUsername('john.doe')
->setProfile(
(new UserServiceSetHumanProfile())
->setGivenName('John')
->setFamilyName('Doe')
)
->setEmail(
(new UserServiceSetHumanEmail())
->setEmail('[email protected]')
));
echo "User created: " . print_r($response, true);
} catch (ApiException $e) {
echo "Error: " . $e->getMessage();
}
```
#### 3. Personal Access Tokens (PATs)
**What is it?**
A Personal Access Token (PAT) is a pre-generated token that you can use to
authenticate without exchanging credentials every time.
**When should you use it?**
- **Easy to use:** Great for development or testing scenarios.
- **Quick setup:** No need for dynamic token generation.
**How do you use it?**
1. Obtain a valid personal access token from your account.
2. Create the authenticator with: `PersonalAccessTokenAuthenticator`
**Example:**
```php
use \Zitadel\Client\Zitadel;
use Zitadel\Client\Zitadel;
use Zitadel\Client\Model\UserServiceAddHumanUserRequest;
use \Zitadel\Client\Model\UserServiceAddHumanUserRequest;
use \Zitadel\Client\Model\UserServiceSetHumanProfile;
use \Zitadel\Client\Model\UserServiceSetHumanEmail;
$zitadel = Zitadel::withAccessToken("https://example.us1.zitadel.cloud", "token");
try {
$response = $zitadel->users->addHumanUser(
(new UserServiceAddHumanUserRequest())
->setUsername('john.doe')
->setProfile(
(new UserServiceSetHumanProfile())
->setGivenName('John')
->setFamilyName('Doe')
)
->setEmail(
(new UserServiceSetHumanEmail())
->setEmail('[email protected]')
)
);
echo "User created: " . print_r($response, true);
} catch (ApiException $e) {
echo "Error: " . $e->getMessage();
}
```
---
Choose the authentication method that best suits your needs based on your
environment and security requirements. For more details, please refer to the
[Zitadel documentation on authenticating service users](https://zitadel.com/docs/guides/integrate/service-users/authenticate-service-users).
### Versioning
The client library's versioning is aligned with the Zitadel core project. The major version of the
client corresponds to the major version of Zitadel it is designed to work with. For example,
v2.x.x of the client is built for and tested against Zitadel v2, ensuring a predictable and stable integration.
### Resources
- [GitHub Repository](https://github.com/zitadel/client-php): For source code, examples, and to report issues.
- [Packagist Package](https://packagist.org/packages/zitadel/client): The official package artifact for Composer.
@@ -0,0 +1,197 @@
---
title: Python Client
sidebar_label: 'Python Client'
---
<table>
<tr>
<td width="100px">
<img width="100px" src="/docs/img/tech/python.svg" alt="python logo"/>
</td>
<td>
This guide covers the official Zitadel Management API Client for Python (3.9+), which allows you to programmatically manage resources in your Zitadel instance.
</td>
</tr>
</table>
:::info
**This is a Management API Client, not an Authentication SDK.**
This library is designed for server-to-server communication to manage your Zitadel instance (e.g., creating users, managing projects, and updating settings). It is **not** intended for handling end-user login flows in your web application. For user authentication, you should use a standard OIDC library with your Python framework of choice, such as `mozilla-django-oidc` for Django or `Authlib` for Flask.
:::
The Zitadel Python Client provides an idiomatic way to access the full gamut of Zitadel's v2 Management APIs from your Python backend.
> Please be aware that this client library is currently in an **incubating stage**.
While it is available for use, the API and its functionality may evolve, potentially introducing
breaking changes in future updates. We advise caution when considering it for production environments.
### Installation
You can add the client library to your project using pip:
```bash
pip install --pre zitadel-client
```
### Using the SDK
Your SDK offers three ways to authenticate with Zitadel. Each method has its
own benefits—choose the one that fits your situation best.
#### 1. Private Key JWT Authentication
**What is it?**
You use a JSON Web Token (JWT) that you sign with a private key stored in a
JSON file. This process creates a secure token.
**When should you use it?**
- **Best for production:** It offers strong security.
- **Advanced control:** You can adjust token settings like expiration.
**How do you use it?**
1. Save your private key in a JSON file.
2. Use the provided method to load this key and create a JWT-based
authenticator.
**Example:**
```python
import zitadel_client as zitadel
from zitadel_client.exceptions import ApiError
from zitadel_client.models import (
UserServiceAddHumanUserRequest,
UserServiceSetHumanEmail,
UserServiceSetHumanProfile,
)
zitadel = zitadel.Zitadel.with_private_key("https://example.us1.zitadel.cloud", "path/to/jwt-key.json")
try:
request = UserServiceAddHumanUserRequest(
username="john.doe",
profile=UserServiceSetHumanProfile(
givenName="John",
familyName="Doe"
),
email=UserServiceSetHumanEmail(
email="[email protected]"
),
)
response = zitadel.users.add_human_user(request)
print("User created:", response)
except ApiError as e:
print("Error:", e)
```
#### 2. Client Credentials Grant
**What is it?**
This method uses a client ID and client secret to get a secure access token,
which is then used to authenticate.
**When should you use it?**
- **Simple and straightforward:** Good for server-to-server communication.
- **Trusted environments:** Use it when both servers are owned or trusted.
**How do you use it?**
1. Provide your client ID and client secret.
2. Build the authenticator
**Example:**
```python
import zitadel_client as zitadel
from zitadel_client.exceptions import ApiError
from zitadel_client.models import (
UserServiceAddHumanUserRequest,
UserServiceSetHumanEmail,
UserServiceSetHumanProfile,
)
zitadel = zitadel.Zitadel.with_client_credentials("https://example.us1.zitadel.cloud", "id", "secret")
try:
request = UserServiceAddHumanUserRequest(
username="john.doe",
profile=UserServiceSetHumanProfile(
givenName="John",
familyName="Doe"
),
email=UserServiceSetHumanEmail(
email="[email protected]"
),
)
response = zitadel.users.add_human_user(request)
print("User created:", response)
except ApiError as e:
print("Error:", e)
```
#### 3. Personal Access Tokens (PATs)
**What is it?**
A Personal Access Token (PAT) is a pre-generated token that you can use to
authenticate without exchanging credentials every time.
**When should you use it?**
- **Easy to use:** Great for development or testing scenarios.
- **Quick setup:** No need for dynamic token generation.
**How do you use it?**
1. Obtain a valid personal access token from your account.
2. Create the authenticator with: `PersonalAccessTokenAuthenticator`
**Example:**
```python
import zitadel_client as zitadel
from zitadel_client.exceptions import ApiError
from zitadel_client.models import (
UserServiceAddHumanUserRequest,
UserServiceSetHumanEmail,
UserServiceSetHumanProfile,
)
zitadel = zitadel.Zitadel.with_access_token("https://example.us1.zitadel.cloud", "token")
try:
request = UserServiceAddHumanUserRequest(
username="john.doe",
profile=UserServiceSetHumanProfile(
givenName="John",
familyName="Doe"
),
email=UserServiceSetHumanEmail(
email="[email protected]"
),
)
response = zitadel.users.add_human_user(request)
print("User created:", response)
except ApiError as e:
print("Error:", e)
```
---
Choose the authentication method that best suits your needs based on your
environment and security requirements. For more details, please refer to the
[Zitadel documentation on authenticating service users](https://zitadel.com/docs/guides/integrate/service-users/authenticate-service-users).
### Versioning
The client library's versioning is aligned with the Zitadel core project. The major version of the
client corresponds to the major version of Zitadel it is designed to work with. For example,
v2.x.x of the client is built for and tested against Zitadel v2, ensuring a predictable and stable integration.
### Resources
- [GitHub Repository](https://github.com/zitadel/client-python): For source code, examples, and to report issues.
- [PyPI Package](https://pypi.org/project/zitadel-client): The official package artifact for pip.
@@ -0,0 +1,200 @@
---
title: Ruby Client
sidebar_label: 'Ruby Client'
---
<table>
<tr>
<td width="100px">
<img width="100px" src="/docs/img/tech/ruby.svg" alt="ruby logo"/>
</td>
<td>
This guide covers the official Zitadel Management API Client for Ruby (3.1+), which allows you to programmatically manage resources in your Zitadel instance.
</td>
</tr>
</table>
:::info
**This is a Management API Client, not an Authentication SDK.**
This library is designed for server-to-server communication to manage your Zitadel instance (e.g., creating users, managing projects, and updating settings). It is **not** intended for handling end-user login flows in your web application. For user authentication, you should use a standard OIDC library with your Ruby framework of choice.
:::
The Zitadel Ruby Client provides an idiomatic way to access the full gamut of Zitadel's v2 Management APIs from your Ruby backend.
> Please be aware that this client library is currently in an **incubating stage**.
While it is available for use, the API and its functionality may evolve, potentially introducing
breaking changes in future updates. We advise caution when considering it for production environments.
### Installation
You can add the client library to your project using RubyGems. Add this line to your application's Gemfile:
```ruby
gem install zitadel-client --pre
```
### Using the SDK
Your SDK offers three ways to authenticate with Zitadel. Each method has its
own benefits—choose the one that fits your situation best.
#### 1. Private Key JWT Authentication
**What is it?**
You use a JSON Web Token (JWT) that you sign with a private key stored in a
JSON file. This process creates a secure token.
**When should you use it?**
- **Best for production:** It offers strong security.
- **Advanced control:** You can adjust token settings like expiration.
**How do you use it?**
1. Save your private key in a JSON file.
2. Use the provided method to create an authenticator.
**Example:**
```ruby
require 'zitadel-client'
require 'securerandom'
client = Zitadel::Client::Zitadel.with_private_key("https://example.us1.zitadel.cloud", "path/to/jwt-key.json")
begin
response = client.users.add_human_user(
Zitadel::Client::UserServiceAddHumanUserRequest.new(
username: SecureRandom.hex,
profile: Zitadel::Client::UserServiceSetHumanProfile.new(
given_name: 'John',
family_name: 'Doe'
),
email: Zitadel::Client::UserServiceSetHumanEmail.new(
email: "[email protected]"
)
)
)
puts "User created: #{response}"
rescue StandardError => e
puts "Error: #{e.message}"
end
```
#### 2. Client Credentials Grant
**What is it?**
This method uses a client ID and client secret to get a secure access token,
which is then used to authenticate.
**When should you use it?**
- **Simple and straightforward:** Good for server-to-server communication.
- **Trusted environments:** Use it when both servers are owned or trusted.
**How do you use it?**
1. Provide your client ID and client secret.
2. Use the provided method to create an authenticator.
**Example:**
```ruby
require 'zitadel-client'
require 'securerandom'
client = Zitadel::Client::Zitadel.with_client_credentials("https://example.us1.zitadel.cloud", "id", "secret")
begin
response = client.users.add_human_user(
Zitadel::Client::UserServiceAddHumanUserRequest.new(
username: SecureRandom.hex,
profile: Zitadel::Client::UserServiceSetHumanProfile.new(
given_name: 'John',
family_name: 'Doe'
),
email: Zitadel::Client::UserServiceSetHumanEmail.new(
email: "[email protected]"
)
)
)
puts "User created: #{response}"
rescue StandardError => e
puts "Error: #{e.message}"
end
```
#### 3. Personal Access Tokens (PATs)
**What is it?**
A Personal Access Token (PAT) is a pre-generated token that you can use to
authenticate without exchanging credentials every time.
**When should you use it?**
- **Easy to use:** Great for development or testing scenarios.
- **Quick setup:** No need for dynamic token generation.
**How do you use it?**
1. Obtain a valid personal access token from your account.
2. Use the provided method to create an authenticator.
**Example:**
```ruby
require 'zitadel-client'
require 'securerandom'
client = Zitadel::Client::Zitadel.with_access_token("https://example.us1.zitadel.cloud", "token")
begin
response = client.users.add_human_user(
Zitadel::Client::UserServiceAddHumanUserRequest.new(
username: SecureRandom.hex,
profile: Zitadel::Client::UserServiceSetHumanProfile.new(
given_name: 'John',
family_name: 'Doe'
),
email: Zitadel::Client::UserServiceSetHumanEmail.new(
email: "[email protected]"
)
)
)
puts "User created: #{response}"
rescue StandardError => e
puts "Error: #{e.message}"
end
```
---
Choose the authentication method that best suits your needs based on your
environment and security requirements. For more details, please refer to the
[Zitadel documentation on authenticating service users](https://zitadel.com/docs/guides/integrate/service-users/authenticate-service-users).
### Debugging
The SDK supports debug logging, which can be enabled for troubleshooting
and debugging purposes. You can enable debug logging by setting the `debug`
flag to `true` when initializing the `Zitadel` client, like this:
```ruby
zitadel = zitadel.Zitadel("your-zitadel-base-url", 'your-valid-token', lambda config: config.debug = True)
```
When enabled, the SDK will log additional information, such as HTTP request
and response details, which can be useful for identifying issues in the
integration or troubleshooting unexpected behavior.
### Versioning
The client library's versioning is aligned with the Zitadel core project. The major version of the
client corresponds to the major version of Zitadel it is designed to work with. For example,
v2.x.x of the client is built for and tested against Zitadel v2, ensuring a predictable and stable integration.
### Resources
- [GitHub Repository](https://github.com/zitadel/client-ruby): For source code, examples, and to report issues.
- [RubyGems Package](https://rubygems.org/gems/zitadel-client): The official package artifact for RubyGems.
+9 -1
View File
@@ -19,9 +19,17 @@ We provide this list for informational purposes and to foster community engageme
import { Frameworks } from "../../src/components/frameworks";
## Clients
<Frameworks filter={(framework) => framework.client === true } />
## SDKs
<Frameworks filter={(framework) => framework.sdk === true } />
## Resources
<Frameworks />
<Frameworks filter={(framework) => framework.client === false || framework.client == null} />
To further streamline your setup, simply visit the console in ZITADEL where you can select one of the languages or frameworks. This will allow you to instantly set up the configuration for that specific sample in ZITADEL, ensuring you have everything you need to get started right away.