typebot.io icon indicating copy to clipboard operation
typebot.io copied to clipboard

error with use keycloak

Open amirmdehghanpour opened this issue 1 year ago • 10 comments

hi i conf my keycloak server same as doc but i get error Try signing with a different account. and when i check log of docker get this [next-auth][error][SIGNIN_OAUTH_ERROR] https://next-auth.js.org/errors#signin_oauth_error Unable to find matching target resource method (For more on this error consult the server log at the debug level.) { error: { message: 'Unable to find matching target resource method (For more on this error consult the server log at the debug level.)', stack: 'OPError: Unable to find matching target resource method (For more on this error consult the server log at the debug level.)\n' + ' at processResponse (/app/node_modules/.pnpm/[email protected]/node_modules/openid-client/lib/helpers/process_response.js:38:13)\n' + ' at Issuer.discover (/app/node_modules/.pnpm/[email protected]/node_modules/openid-client/lib/issuer.js:151:18)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' + ' at async openidClient (/app/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected][email protected]___am5p4555usmjvg5xfootnx4hbe/node_modules/next-auth/core/lib/oauth/client.js:16:14)\n' + ' at async getAuthorizationUrl (/app/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected][email protected]___am5p4555usmjvg5xfootnx4hbe/node_modules/next-auth/core/lib/oauth/authorization-url.js:70:18)\n' + ' at async Object.signin (/app/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected][email protected]___am5p4555usmjvg5xfootnx4hbe/node_modules/next-auth/core/routes/signin.js:38:24)\n' + ' at async AuthHandler (/app/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected][email protected]___am5p4555usmjvg5xfootnx4hbe/node_modules/next-auth/core/index.js:260:26)\n' + ' at async NextAuthApiHandler (/app/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected][email protected]___am5p4555usmjvg5xfootnx4hbe/node_modules/next-auth/next/index.js:22:19)\n' + ' at async z (/app/apps/builder/.next/server/chunks/5043.js:1:8413)\n' + ' at async K (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16545)', name: 'OPError' }, providerId: 'keycloak', message: 'Unable to find matching target resource method (For more on this error consult the server log at the debug level.)' } and this is Screenshot of the error when i click to login with keycloak i get Screenshot 2024-08-15 at 09-03-08 Sign In Typebot

amirmdehghanpour avatar Aug 14 '24 18:08 amirmdehghanpour

Can you share your config?

baptisteArno avatar Aug 16 '24 16:08 baptisteArno

yes this is my .env file

` ENCRYPTION_SECRET=xxxxxxxxxxxxx

DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot

NODE_OPTIONS=--no-node-snapshot

NEXTAUTH_URL=https://app.setadeiran.com NEXT_PUBLIC_VIEWER_URL=https://bot.setadeiran.com

[email protected]

For more configuration options check out: https://docs.typebot.io/self-hosting/configuration

SMTP_USERNAME=xxxxxxxxxxxxxxxx SMTP_PASSWORD=xxxxxxxxxxxx SMTP_HOST=mail.setadeiran.com SMTP_PORT=465 NEXT_PUBLIC_SMTP_FROM="'Typebot Notifications' [email protected]"

KEYCLOAK_CLIENT_ID=typebot KEYCLOAK_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxx KEYCLOAK_REALM=master KEYCLOAK_BASE_URL=https://key.amirmdehghanpour.ir/ and this is my keycloak conf{ "realm": "master", "auth-server-url": "https://key.amirmdehghanpour.ir/", "ssl-required": "external", "resource": "typebot", "credentials": { "secret": "xxxxxxxxxxxxxxxxxx " }, "confidential-port": 0 }` Screenshot 2024-08-16 at 12-17-13 Keycloak Administration Console Screenshot 2024-08-16 at 12-17-05 Keycloak Administration Console

amirmdehghanpour avatar Aug 16 '24 19:08 amirmdehghanpour

Have you tried KEYCLOAK_BASE_URL=https://key.amirmdehghanpour.ir/ without end slash?

baptisteArno avatar Aug 19 '24 12:08 baptisteArno

yes i tried but no change effect its get same error

amirmdehghanpour avatar Aug 19 '24 16:08 amirmdehghanpour

I am not familiar with Keycloak so I am running out of idea 🤔

baptisteArno avatar Aug 20 '24 13:08 baptisteArno

The error is OPError: Unable to find matching target resource method (For more on this error consult the server log at the debug level.)

baptisteArno avatar Aug 20 '24 13:08 baptisteArno

how fix it?

amirmdehghanpour avatar Aug 20 '24 16:08 amirmdehghanpour

i check the typebot log in docker and get this again!!! Screenshot from 2024-08-20 19-39-23

amirmdehghanpour avatar Aug 20 '24 16:08 amirmdehghanpour

Hi, @amirmdehghanpour, I checked, and your error seems similar to one I encountered.

I was able to authenticate successfully via Keycloak with the following settings:

image

  • Make sure to use double quotes for KEYCLOAK_CLIENT_ID and KEYCLOAK_CLIENT_SECRET.

  • The KEYCLOAK_BASE_URL needs to include /auth/realms in your Keycloak domain. For example: https://yourdomainkeycloak/auth/realms

In the Keycloak admin interface, I configured it as follows:

image

image

Let me know if this works for you too!

brmattge avatar Sep 04 '24 22:09 brmattge

Hi, @amirmdehghanpour, I checked, and your error seems similar to one I encountered.

I was able to authenticate successfully via Keycloak with the following settings:

image

* Make sure to use double quotes for KEYCLOAK_CLIENT_ID and KEYCLOAK_CLIENT_SECRET.

* The KEYCLOAK_BASE_URL needs to include /auth/realms in your Keycloak domain. For example: https://yourdomainkeycloak/auth/realms

In the Keycloak admin interface, I configured it as follows:

image

image

Let me know if this works for you too!

hi @brmattge i change env like you say but didint work

amirmdehghanpour avatar Sep 05 '24 16:09 amirmdehghanpour

Closing, feel free to re-open

baptisteArno avatar Nov 12 '24 15:11 baptisteArno

its stil not work

amirmdehghanpour avatar Nov 14 '24 16:11 amirmdehghanpour