{"id":18021342,"url":"https://github.com/2mol/keycloak-twilio-example","last_synced_at":"2026-02-22T20:02:57.684Z","repository":{"id":146590332,"uuid":"331273823","full_name":"2mol/keycloak-twilio-example","owner":"2mol","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-20T11:51:24.000Z","size":23,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T10:37:42.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2mol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-20T10:39:00.000Z","updated_at":"2023-10-24T19:28:16.000Z","dependencies_parsed_at":"2023-06-26T01:48:08.889Z","dependency_job_id":null,"html_url":"https://github.com/2mol/keycloak-twilio-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/2mol/keycloak-twilio-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2mol%2Fkeycloak-twilio-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2mol%2Fkeycloak-twilio-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2mol%2Fkeycloak-twilio-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2mol%2Fkeycloak-twilio-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2mol","download_url":"https://codeload.github.com/2mol/keycloak-twilio-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2mol%2Fkeycloak-twilio-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29725293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T19:57:12.410Z","status":"ssl_error","status_checked_at":"2026-02-22T19:54:50.710Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T06:09:35.430Z","updated_at":"2026-02-22T20:02:57.664Z","avatar_url":"https://github.com/2mol.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keycloak + Twilio SDK\n\nThis repo is for reproducing a bug where the `log4j` dependency from Twilio seems to clash with the one from `keycloak-services` (transitive dependency, check with `mvn dependency:tree`).\n\nRelevant repos:\n\n- https://github.com/twilio/twilio-java\n- https://github.com/keycloak/keycloak\n\nThis code example is based on `https://www.n-k.de/2020/12/keycloak-2fa-sms-authentication.html`, and its corresponding repo: https://github.com/dasniko/keycloak-2fa-sms-authenticator.\n\n## How to reproduce\n\nDependencies are maven, openjdk 11, and docker.\n\n- build the module with `mvn clean package`.\n- Create an `.env` file, use `example.env` as a template. This is needed for the Twilio token.\n- Start a keycloak container with `docker run --name keycloak -p 8080:8080 --env-file .env quay.io/keycloak/keycloak:12.0.1`\n- Copy the compiled module .jar over with `docker cp target/example-keycloak-2fa-sms-authenticator-*.jar keycloak:/opt/jboss/keycloak/standalone/deployments/`. The keycloak logs will show the module being loaded.\n\nNow the more manual part is to trigger usage of the module:\n\n- Log into Keycloak with admin/admin.\n- Create a new realm (hover over the realm name).\n- **\u003e Realm Settings \u003e Login:** Enable user registration\n- register a new user account. You can find the link under **\u003e Clients**\n- **\u003e Authentication:** Make a copy of the Browser Flow\n    - Add execution under \"Copy Of Browser Forms\" or whatever you named it\n    - Select the SMS Authentication\n    - Set it to REQUIRED\n    - For the SMS Authentication step, use the dropdown to go to **config**\n        - give it a name, **save**, then switch off simulation mode, then **save again**\n    - Go back. Under the **Bindings** tab, select your new flow as the new Browser Flow\n    - Save\n- **\u003e Users** select your user, go to the **Attributes** tab, and add a new key:\n    - `mobile_number`, and whatever value you want. Doesn't have to be a real phone number.\n    - Save\n- Now try to sign in (same URL that you used to register a user).\n\nYou should get an internal server error in the browser, and see the dreaded `No class provided` error in the Keycloak console output:\n\n```\nCaused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.\n\tat deployment.example-keycloak-2fa-sms-authenticator-1.0-SNAPSHOT.jar//org.apache.logging.log4j.LogManager.callerClass(LogManager.java:571)\n...\n```\n\n## How to make it work\n\nDowngrade the version number of the Twilio SDK in `pom.xml`: Change to 8.3.0 under `\u003ctwilio.version\u003e8.6.0\u003c/twilio.version\u003e`.\n\nThis version doesn't use `log4j`, and the integration works.\n\nNote: for this it is better to have real phone numbers, both under your user account, as well as the `PHONE_NUMBER_FROM` variable in `.env`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2mol%2Fkeycloak-twilio-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2mol%2Fkeycloak-twilio-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2mol%2Fkeycloak-twilio-example/lists"}