# SSO

PerfectScale enables user access through Zitadel, an open-source identity management platform. To start using Zitadel with PerfectScale, you’ll first need to create a Zitadel Identity provider for OKTA or integrate Zitadel with G Suite.

## **Creating a Zitadel identity provider for OKTA** <a href="#creating-a-zitadel-identity-provider-for-okta" id="creating-a-zitadel-identity-provider-for-okta"></a>

1. Log in to the **Zitadel Admin Console** and navigate to **Default Settings** → **Identity providers**.
2. Select **Generic OIDC**.<br>

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FYvnG7WTClZtYx6mwTpSG%2FGroup%201000001800%20(1).png?alt=media&#x26;token=e043f3ca-875a-483d-bea8-cbc41e38636c" alt=""><figcaption><p>Select Generic OIDC</p></figcaption></figure>
3. Log in to Okta:
   * Access the **Admin Console** and select **Security** from the side menu.
   * Go to **API:**
     * Copy the **Issuer URI** for the **default** auth server.
     * Use the copied value in Zitadel as the **Issuer**.
   * Navigate to the **TrustedOrigins** tab and click the **+Add Origin** button:
     * Paste the Zitadel URL as the origin URL: [https://zitadel.dev.perfectscale.click](https://zitadel.dev.perfectscale.click/).
     * Allow cors and redirect.
4. Return to the **Authorization servers** tab and enter the **default** server settings by pressing on the server name.
5. Navigate to the **Access Policies t**ab:
   * Add a new Access policy.
   * Create a policy to allow all users
   * Add a scope to the policy for **all**.
6. From the Okta side menu, navigate to **applications**:
   * Create a **new app integration**.
   * Choose **OIDC**.
   * Choose **Web Application**.
   * Click next.
   * Add the Zitadel redirect URI in the **redirectURIs:** <https://zitadel.dev.perfectscale.click/ui/login/login/externalidp/callback>
   * Choose to **allow everyone in your organization to access** and save.
7. Go into the newly created application details page (click on the app inside **applications**)
8. Copy the **ClientID** and **Secret** and paste the credentials into the **Zitadel** provider page.

Once OKTA is configured, users from your organization can sign up and log in to your PerfectScale account.

## Integrating Zitadel with G Suite

1. Log in to the **Zitadel Admin Console** and navigate to **Default Settings** → **Identity providers**.
2. Select **SAML** from the **Add Provider** list.<br>

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2Fx4eHzOVgur59FS6H8xCQ%2FGroup%201000001800.png?alt=media&#x26;token=d5a01aac-f68d-4fe8-ae75-d1669239dadf" alt=""><figcaption><p>Select SAML</p></figcaption></figure>
3. Open Google Workspace and select the **Add custom SAML app** from the **Add app** drop-down list.<br>

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FH2Wz2zHImTdnkbys4KdJ%2FGroup%201000001801.png?alt=media&#x26;token=ddf9eef2-2fa0-4939-a064-06f92c91271d" alt=""><figcaption><p>Add custom SAML app</p></figcaption></figure>
4. Name the app, create a description, and click Continue.
5. Click **Download Metadata** and paste the content in the identity provider.<br>

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FIXHK64vz8of3PPAzs2ID%2FGroup%201000001802.png?alt=media&#x26;token=f0b5e27a-1e50-4501-a83f-dd54d159f13b" alt=""><figcaption><p>Download metadata</p></figcaption></figure>
6. Paste the content in **Zitadel Metadata XML** and click **Continue**.
7. &#x20;Copy the **Zitadel ACS Login Form** and **Zitadel Metadata** from the list Zitadel provided and insert them to the **ACS URL** and **Entity ID** in G-Suite admin accordingly.<br>

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FtGSdx6jGx1LBhqjmq5o8%2FFrame%201000001432%20(1).png?alt=media&#x26;token=18bc876c-65e2-48a1-9bcb-33ef37e2ed06" alt=""><figcaption><p>Configure SAML</p></figcaption></figure>
8. Click **Continue** and **Finish**.
9. Activate the application in G Suite for users.<br>

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FYFyBP3nhfGMEEeaOFkmu%2FFrame%201000001433%20(1).png?alt=media&#x26;token=e0c9162a-3620-44c0-a2b9-04f90c69bb4f" alt=""><figcaption><p>Activate the app in G Suite</p></figcaption></figure>
10. Click **Activate** and **Save** in Zitadel.<br>

    <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FUC2LXgdZajrvcNMw1gPg%2FFrame%201000001434.png?alt=media&#x26;token=8215ce6c-a42f-4059-8ece-eaaaf9f6f903" alt=""><figcaption><p>Activate in Ziadel</p></figcaption></figure>

## Integrating Zitadel with Azure

1. **Register Azure AD App**
   * Log in to the [Azure Portal](https://portal.azure.com/) and navigate to **Azure Active Directory** -> **App registrations** -> **New registration**.
   * Name the application: `Zitadel-OIDC`
   * Configure the redirect URL with the following parameters:
     * `Web`
     * `https://DOMAIN/oidc/v1/callback` (adjust based on ZITADEL deployment)
   * Click **Register**.

<figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FIvfzNWcnwTxkGvL2t91Z%2FGroup%201000001826.png?alt=media&#x26;token=fb1cb529-e360-48a7-8975-07e91ebaaf73" alt=""><figcaption><p><strong>Azure AD application registration</strong></p></figcaption></figure>

2. **Configure application settings**

   * Go to your **Manage** -> **Authentication**
     * Add your ZITADEL redirect URL if it is not already included.
     * Check the box for ID tokens.
     * Add Web redirect URL: [https://DOMAIN/ui/login/login/externalidp/callback](https://zitadel.dev.perfectscale.click/ui/login/login/externalidp/callback).

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FhOA4kvNgILPGX78mDUse%2FFrame%201000001440.png?alt=media&#x26;token=817cb1a9-b29e-492d-96fd-f22c3b2206a3" alt=""><figcaption><p>Application settings configuration</p></figcaption></figure>

   * In **API permissions**, ensure that `openid`, `profile`, and `email` are included. If not, add **Microsoft Graph** -> **Delegated** permissions.

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FCjH4qKF9vaeVJKSWHryk%2FFrame%201000001441.png?alt=media&#x26;token=54b981fe-5311-4514-9587-86f6f64c1595" alt=""><figcaption><p>API permissions</p></figcaption></figure>

   * In **Certificates & Secrets**, add a new **Client Secret**, and copy it.
3. **Configure token**\
   To enable ZITADEL to obtain information from the authenticating user, you need to configure which optional claims should be returned in the token.

   * In the Token configuration, click the `+ Add optional claim` button
   * Check the box for `email`, `family_name`, `given_name` and `preferred_username` .

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2F0OTdIgAq2QSgg7hU4XtP%2FFrame%201000001442.png?alt=media&#x26;token=846d3393-b0cc-44bc-91c6-9a8d2565a9fa" alt=""><figcaption><p>Token configuration</p></figcaption></figure>
4. **Get Azure AD OIDC details**

   * **Issuer/Discovery URL**: `https://login.microsoftonline.com/<tenant-id>/v2.0`.
   * **Client ID**: from the registered application.
   * **Client Secret**: from **step 2** above.
   * **Scopes**: `openid`, `email`, `profile`&#x20;

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2F69JzQKxRC8kSkCtE6Oa0%2FGroup%201000001841.png?alt=media&#x26;token=b830edf9-ab1f-4e36-bbb5-36a2cf78b259" alt=""><figcaption></figcaption></figure>
5. **Add Azure AD as OIDC Provider in ZITADEL**

   * In the ZITADEL Console (admin login), navigate to **Organization** -> **Login Behavior and Security** to ensure that the box **`External allowed`** is checked.

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2F9UnTpFFvGPeysQ8pblv5%2FFrame%201000001444.png?alt=media&#x26;token=d7973926-8f2c-4044-8f21-0835cf4ecd3d" alt=""><figcaption><p>Login form customization</p></figcaption></figure>

   * Go to **Organization** -> **Login and Access** -> **Identity Providers**
   * Click **Add Identity Provider**, choose **Microsoft,** and update the configuration:

     * **Name**: `AzureAD`
     * **Client ID**: from Azure AD
     * **Client Secret**: from Azure AD

     <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2F3rTzSqo33YA9Ac6dcuO7%2FGroup%201000001842.png?alt=media&#x26;token=84548fd3-a040-4a14-9354-ad847362315e" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
If the email server isn’t set up in Zitadel, or if there’s no need to verify Azure emails further since they are already sufficiently verified, make sure to check the `Email verified` box.
{% endhint %}

<figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FVQQgA8OQa0XYTbTdZdgy%2Fimage.png?alt=media&#x26;token=eb5d9c60-658c-4d15-a9db-8fd134a89bdb" alt=""><figcaption><p>Identity provider configuration2</p></figcaption></figure>

6. **Activate the Identity Provider for login**

   * Once the identity provider is saved, open it and activate.

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2FjSImVhwM5SAe2bPfS3B8%2Fimage.png?alt=media&#x26;token=cbd1fa55-eaa2-4210-bb20-74005a4fd6c4" alt=""><figcaption><p>IdP activation</p></figcaption></figure>

   * Test the login flow with **AzureAD**.

   <figure><img src="https://3591580169-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzCh9aABpk7yLeToPr6vk%2Fuploads%2Foc1XrHDBAV1U0LY0mszm%2Fimage.png?alt=media&#x26;token=e97d7178-3b84-4d3f-b925-8dfe040a9dbd" alt=""><figcaption><p>AzureAD test</p></figcaption></figure>

{% embed url="<https://zitadel.com/docs/guides/integrate/identity-providers/azure-ad-oidc>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.perfectscale.io/2.0-self-hosted-or-perfectscale-documentation/administration/security/sso.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
