title: How do I correctly register a custom FormAction in Keycloak?
body: <p>Keycloak 1.9.1-Final</p>
  
  <p>I've implemented the following custom FormActionFactory.</p>
  
  <pre><code>public class RegistrationFormActionFactory implements FormActionFactory{
  
      public static final String PROVIDER_ID = "rc-registration-profile-action";
  
      @Override    
      public FormAction create(KeycloakSession session){
          return new RegistrationFormAction();
      }
  
      @Override
      public String getDisplayType(){
          return "RC Profile Validation";
      }
   ...
  </code></pre>
  
  <p>And the associated FormAction modeled after <a href="https://github.com/keycloak/keycloak/blob/5c98b8c6ae7052b2d906156d8fc212ccd9dfd57d/services/src/main/java/org/keycloak/authentication/forms/RegistrationProfile.java" rel="nofollow">org.keycloak.authentication.forms.RegistrationProfile</a></p>
  
  <pre><code>public class RegistrationFormAction implements FormAction{
  ...
  </code></pre>
  
  <p>in META-INF/services of the jar I have a file: <em>org.keycloak.authentication.FormActionFactory</em></p>
  
  <p>containing only the following text:</p>
  
  <pre><code>com.realcomp.keycloak.RegistrationFormActionFactory
  </code></pre>
  
  <p>Within the Keycloak admin pages, I have made a copy of the <em>Registration</em> authentication flow and named it <em>Copy of Registration</em>.  When adding an <em>execution</em> to my new flow I see my custom "<em>RC Profile Validation</em>" FormAction on the drop-down list of available providers.  When selected, I get the following exception in the Keycloak server logs:</p>
  
  <pre><code>14:31:00,264 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-54) RESTEASY002005: Failed executing POST /admin/realms/master/authentication/flows/Copy of registration registration form/executions/execution: org.jboss.resteasy.spi.BadRequestException: No authentication provider found for id: rc-registration-profile-action
  at org.keycloak.services.resources.admin.AuthenticationManagementResource.addExecution(AuthenticationManagementResource.java:394)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
  (omitted...)
  </code></pre>
  
  <p>Interesting side note: If I change the PROVIDER_ID in my FormActionFactory to "<em>registration-profile-action</em>" everything works as expected.  However, this PROVIDER_ID is used by the RegistrationProfile class and feels wrong.</p>
  
  <p>I increased logging verbosity and it appears my FormAction <em>is</em> being loaded:</p>
  
  <pre><code>17:07:20,659 DEBUG [org.keycloak.services] (ServerService Thread Pool -- 50) Loaded SPI form-action (providers = [registration-profile-action, rc-registration-profile-action, registration-recaptcha-action, registration-password-action, registration-user-creation])
  </code></pre>
  
  <p>I've likely missed some configuration step.  Any ideas on what I did wrong here?</p>