# KeyCloak

### KeyCloak as Identity Provider

To use KeyCloak as an Auth Provider, you must install and maintain an own installation of KeyCloak.  A docker installation is fast achieved.

<https://www.keycloak.org/getting-started/getting-started-docker>&#x20;

In KeyCloak you have to set up first a "Realm". This is a tenant within KeyCloak. Select (or create) your Realm with the top left corner menu.

In your Realm, you can then create and configure a Client. We show here the most minimal configuration to enable Sign in and Sign up with KeyCloak for Lowcoder.

### Setup a KeyCloak Client

Choose a name and id for your Client.

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FQtrEQrypzwWJMN1xZkBr%2FKeyCloak%20Client%20setup%201.png?alt=media&#x26;token=dcd48a28-7b1d-4745-9aff-23b6d4957483" alt=""><figcaption></figcaption></figure>

Make sure the "Standard Flow" is activated, as also "Client authentication" and "Authorization". Only when checked these options, KeyCloak will issue the needed Client-Secret.

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FZlUZLOkYXOoCQYGPPObC%2FKeyCloak%20Client%20setup%202.png?alt=media&#x26;token=b1f79578-ab04-42cb-b17d-51a70db50cdf" alt=""><figcaption></figcaption></figure>

Configure the Lowcoder redirect URLs.

{% hint style="info" %}
For the cloud, the "Valid redirect URI" is <https://app.lowcoder.cloud>
{% endhint %}

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FVDc6Gy4xPjV14BjAUqSp%2FKeyCloak%20Client%20Setup%203.png?alt=media&#x26;token=68c660df-51a9-4860-b336-66299098029d" alt=""><figcaption></figcaption></figure>

After the setup, you can now look for the generated Client-Secret.

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FCdS2Jc2UnAUZKPn8q8gE%2FKeyCloak%20Credencials%20Screen.png?alt=media&#x26;token=28a3ca8c-88ad-430d-aa27-59e370ce8225" alt=""><figcaption><p>copy the Client Secret for the setup of KeyCloak as Auth Provioder in Lowcoder</p></figcaption></figure>

Check the Settings to make sure the right capabilities are activated...

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2F69GmzaRQJ7KYvsIs8nip%2FKeyCloak%20Capabilities%20Screen.png?alt=media&#x26;token=a344f685-57e0-4742-8097-f5cbb2344eef" alt=""><figcaption></figcaption></figure>

### KeyCloak as Lowcoder Auth Provider

in Lowcoder, go to Settings > OAuth Provider and select "KeyCloak" in the "Add OAuth Provider Dialogue"

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2Fnta1oDT44nvkQnCQH1qy%2FKeyCloak%20select%20Provider.png?alt=media&#x26;token=7d1cab1e-bdda-4fc1-b299-e35aa14a25ef" alt=""><figcaption></figcaption></figure>

Now you can enter all settings for KeyCloak

{% hint style="info" %}
Instance ID is the Base URL of your KeyCloak Installation
{% endhint %}

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FEPFMASj140D7h7iaEywE%2FKeyCloak%20Setup.png?alt=media&#x26;token=3917af05-0f94-403d-a832-d9a0e84b5e63" alt=""><figcaption></figcaption></figure>

You can also change settings later.

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2Fv9aDmxu2xy2Kt7XVT1E3%2FKeyCloak%20Settings.png?alt=media&#x26;token=9564d1d9-e7b0-496e-924c-f34fe6b70d66" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
The minimal scope to setup is "offline\_access openid".
{% endhint %}

Thats it! Now you can use KeyCloak to offer your Users to Sign in and Sign up with KeyCloak.

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FFBQ8ZjxSEQcBxnTtMRot%2FKeyCloak%20Sign%20in.png?alt=media&#x26;token=e49ae807-1177-40b9-a85a-a881be99d07e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2F0BVmDGugLvDiKkyhvCb1%2FKeyCloak%20use%20Login.png?alt=media&#x26;token=116314bd-34b6-4f49-b045-33a9324c149c" alt=""><figcaption></figcaption></figure>
