> For the complete documentation index, see [llms.txt](https://docs.openg2p.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openg2p.org/products/pbms/previous-generation/functionality/administration/role-based-access-control/user-guides/configure-keycloak-authentication-provider-for-user-log-in.md).

# Configure Keycloak Authentication Provider for User Log in

This document provides instructions on how to configure Keycloak Authentication Provider in PBMS to help the end-users to utilise the Keycloak option to log into PBMS.

## Prerequisites

* Create a Keycloak client for PBMS/Social Registry as given in [Keycloak Client Creation](/operations/deployment/deployment-guide/keycloak/keycloak-client-creation.md) guide.
* Install the OpenID Connect Authentication module.

Note:

* OAuth providers can be created from Odoo Settings (debug mode).
* For configuration reference refer the [OpenID Connect Authentication](/products/pbms/previous-generation/developer-zone/odoo-modules/openid-connect-authentication.md) documentation.

## Procedure

1. Click the main menu icon ![](/files/xKhS7qdJDqpzfMgT2JTm) and select ***Settings***.

<figure><img src="/files/5tiUOXwdubvXfyUSZjPL" alt=""><figcaption></figcaption></figure>

The ***Settings*** screen is displayed.

2. Select the tab ***Users & Companies***, and click the option ***OAUTH Providers***.

<figure><img src="/files/hlCBm3bKGqPorngSCAWY" alt=""><figcaption></figcaption></figure>

***Providers*** screen is displayed.

<figure><img src="/files/1rR0ZIyMuHZpsoQTVI7K" alt=""><figcaption></figcaption></figure>

3. Click the ***New*** button.

***Providers New*** screen is displayed.

<figure><img src="/files/2FNrNLUGkxRYeiuNGMJB" alt=""><figcaption></figcaption></figure>

4. Enter the values in the respective fields.

For example, the fields, their descriptions, and sample values are given below.

<table><thead><tr><th width="230">Feature</th><th width="281">Description</th><th>Value</th></tr></thead><tbody><tr><td>Provider name</td><td>Enter the provider name.</td><td>For example: Keycloak for PBMS Login</td></tr><tr><td>Auth Flow</td><td>Select the option <em><strong>OpenID Connect Authorization Code Flow</strong></em> from the drop-down.</td><td></td></tr><tr><td>Token Map</td><td>You can find a default value. In the default value change <code>sub:user_id</code> to <code>email:user_id</code> and <code>groups:groups</code> to <code>client_roles:groups</code> .</td><td></td></tr><tr><td>Client ID</td><td><p>The ID of the Keycloak client.</p><p>To learn more refer to <a href="/pages/27GEhm7TLZ7XKCtjol49">Keycloak Client Creation</a>.</p></td><td></td></tr><tr><td>Client Authentication Method</td><td>Select the option <em><strong>Client Secret (Post)</strong></em> from the drop-down.</td><td></td></tr><tr><td>Client Secret</td><td>The <em><strong>Client Secret</strong></em> of the Keycloak client. To learn more, refer to <a href="https://docs.openg2p.org/deployment/deployment-guide/keycloak-client-creation">Keycloak Client Creation</a>.</td><td></td></tr><tr><td>Allowed</td><td>Check the box to enable the option <em><strong>Allowed</strong></em>.</td><td></td></tr><tr><td>Allowed in Self Service Portal</td><td>Uncheck the box.</td><td></td></tr><tr><td>Allowed in Service Provider Portal</td><td>Uncheck the box.</td><td></td></tr><tr><td>Login button label</td><td>Enter the label name for the Keycloak Login button.</td><td><p>For example: <code>Login with Keycloak.</code></p><p>Note: This text with the button name will appear on login page.</p></td></tr><tr><td>Image Icon URL</td><td>Enter the URL of an image for the Keycloak Login button.</td><td></td></tr><tr><td>Authorization URL, Userinfo URL, Token Endpoint, JWKS URL</td><td><p>These are to be configured as available in the well-known config of Keycloak.</p><p>Note:</p><p>Keycloak OIDC well-known configuration can be found in Keycloak Admin Console -> Realm Settings -> (Bottom of Page) Endpoints -> OIDC Endpoint Configuration)</p></td><td></td></tr><tr><td>Verify Access Token Hash</td><td>Check the box to enable the option <em><strong>Verify Access Token</strong></em>.</td><td></td></tr><tr><td>Allow Signup</td><td>Select the option <em><strong>Allows user signup</strong></em> from the drop-down.</td><td></td></tr><tr><td>Signup Default Groups</td><td>Select the option <em><strong>User types/Portal</strong></em> from the drop-down.</td><td></td></tr><tr><td>Sync User Groups</td><td>Select the option <em><strong>On every Login</strong></em> from the drop-down.</td><td></td></tr></tbody></table>

Note:

The rest of the fields have the default values.

5. Click the icon ![](/files/jp22FByGxi9zE0ne6Dng) to save the changes.

If you have configured the ***Keycloak Authentication Provider*** successfully, you can find the ***Log in Keycloak*** button in the PBMS log in page.

Before log in using the option Keycloak in PBMS, ensure the following:

* Create client roles on Keycloak application for the client. The client roles can be
  * Administrator/Settings.
  * OpenG2P Module Access/Administrator.
  * OpenG2P Module Access/Registrar.

<figure><img src="/files/uXS5LBwtE3MGmoe70NmY" alt=""><figcaption></figcaption></figure>

This completes the configuration of ***Keycloak Authentication Provider*** in PBMS for user log in.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.openg2p.org/products/pbms/previous-generation/functionality/administration/role-based-access-control/user-guides/configure-keycloak-authentication-provider-for-user-log-in.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
