p2-inc / keycloak-magic-link

Magic Link Authentication for Keycloak
https://phasetwo.io
Other
245 stars 50 forks source link

Magic link url does not work #89

Closed Ergeros closed 2 months ago

Ergeros commented 2 months ago

Hi, I tried to run keycloak image with the magic link implementation based on the readme. I've tried using this Docker file image My config of docker-compose.yml `version: "3"

volumes: postgres_data: driver: local

services: postgres: image: postgres volumes:

But when i try to run curl from readme curl --request POST http://localhost:8080/auth/realms/master/magic-link \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer <access_token>" \ --data '{"email":"foo@foo.com","client_id":"account-console","redirect_uri":"http://localhost:8080/auth/realms/master/account/","expiration_seconds":3600,"force_create":true,"update_profile":true,"update_password":true,"send_email":false}'

i get this error message {"error":"Unable to find matching target resource method","error_description":"For more on this error consult the server log at the debug level."}

Is there something that i missed in the setup?

xgp commented 2 months ago

You are using a relative path in your url ("/auth") but have not specified it in your configuration. E.g. KC_HTTP_RELATIVE_PATH: /auth

Ergeros commented 2 months ago

Thanks that worked. But now i get this error message "Magic links not allowed for master realm" I already set magic link flow as browser flow in authentication tab.

xgp commented 2 months ago

Magic links are not allowed for the master realm. Two issues:

  1. Misuse of them can create an enormous security hole.
  2. IMO the master realm should only ever be used for creating new realms, creating initial admin users, and break-glass procedures in case of failure breach. Using it for anything else is really problematic from a security perspective.
Ergeros commented 2 months ago

Yes i know. I just trying to make POC for extension if it fits our needs. Then i will you use different realms.