Answers: <p>The root cause is BasePlugin is deprecated and removed from kong 3.x,see it <a href="https://docs.konghq.com/gateway/latest/plugin-development/custom-logic/#migrating-from-baseplugin-module" rel="nofollow noreferrer">here</a>.The jwt-keycloak plugin imported BasePlugin in handler.lua, so you have to do the migration by yourself,it's easy,just fork its repo,change code,install it from source in Dockerfile。</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-01-05T09:16:17.467Z
Answers: Please share with me the details about: "change code" of your answer.
Answers: helle
Answers: CC BY-SA 4.0
Answers: 2023-01-16T07:54:16.933Z
Answers: https://github.com/zjjfly/kong-plugin-jwt-keycloak, this is my repo forked from gbbirkisson's repo，you can find my changes in commit history
Answers: 资俊杰
Answers: CC BY-SA 4.0
Answers: 2023-01-05T04:35:48.743Z
Answers: 2023-01-05T04:35:48.743Z
Answers: 资俊杰
Body: <p>I found a <a href="https://dev.to/robincher/securing-your-site-via-oidc-powered-by-kong-and-keycloak-2ccc" rel="nofollow noreferrer">tutorial</a> how to setup kong with two open source plugins to get keycloak working with kong, but unfortunately it is 2 years old and I ran in troubles.</p>
  <p>Most of the steps still worked and I was able to install the plugin versions in the tutorial via <code>luarocks</code>. unfortunately, the kong did not restart after configuring it to work with the plugins:</p>
  <p><code>plungins = bundeld,oidc,jwt-keycloak</code></p>
  <p>running in the error, that the <code>kong.plugins.base_plugin</code> cannot be found:</p>
  <pre><code>Error: /usr/local/share/lua/5.1/kong/tools/utils.lua:708: error loading module 'kong.plugins.oidc.handler':
  /usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:1: module 'kong.plugins.base_plugin' not found:No LuaRocks module found for kong.plugins.base_plugin
      no field package.preload['kong.plugins.base_plugin']
  </code></pre>
  <p><strong>What I tried</strong></p>
  <ul>
  <li>I tried to install a <code>base_plugin</code> but lua does not find any.</li>
  <li>I was googling a lot, but did't quite found the same issue.</li>
  </ul>
  <p>Well, I am quite stuck and was wondering if there is an other way (maybe directly with the oAuth plugin?), or how I can fix this issue. Also I don't really know how debug that issue and am happy for ideas!</p>
  
Tags: <api-gateway><keycloak>
Title: Setting up Keycloak with Kong v5.1
UserDisplayName: helle
ThreadText: # Setting up Keycloak with Kong v5.1
  
  (Asked by: username_0 on 2022-11-18)
  
  I found a [tutorial](https://dev.to/robincher/securing-your-site-via-oidc-powered-by-kong-and-keycloak-2ccc) how to setup kong with two open source plugins to get keycloak working with kong, but unfortunately it is 2 years old and I ran in troubles.
  
  Most of the steps still worked and I was able to install the plugin versions in the tutorial via `luarocks`. unfortunately, the kong did not restart after configuring it to work with the plugins:
  
  `plungins = bundeld,oidc,jwt-keycloak`
  
  running in the error, that the `kong.plugins.base_plugin` cannot be found:
  
  ```
  Error: /usr/local/share/lua/5.1/kong/tools/utils.lua:708: error loading module 'kong.plugins.oidc.handler':
  /usr/local/share/lua/5.1/kong/plugins/oidc/handler.lua:1: module 'kong.plugins.base_plugin' not found:No LuaRocks module found for kong.plugins.base_plugin
      no field package.preload['kong.plugins.base_plugin']
  
  ```
  
  **What I tried**
  
  * I tried to install a `base_plugin` but lua does not find any.
  * I was googling a lot, but did't quite found the same issue.
  
  Well, I am quite stuck and was wondering if there is an other way (maybe directly with the oAuth plugin?), or how I can fix this issue. Also I don't really know how debug that issue and am happy for ideas!
  
  **Tags:** api-gateway, keycloak
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-01-05. Score: 1
  
  The root cause is BasePlugin is deprecated and removed from kong 3.x,see it [here](https://docs.konghq.com/gateway/latest/plugin-development/custom-logic/#migrating-from-baseplugin-module).The jwt-keycloak plugin imported BasePlugin in handler.lua, so you have to do the migration by yourself,it's easy,just fork its repo,change code,install it from source in Dockerfile。
  
  > **Comments:**
  > **username_0**: Please share with me the details about: "change code" of your answer.  
  > **username_1**: https://github.com/zjjfly/kong-plugin-jwt-keycloak, this is my repo forked from gbbirkisson's repo，you can find my changes in commit history  
  
  ---
  
  