title: Apache Airflow 2.0.0 Trigger a DAG Run via the Stable REST API fails with FORBIDDEN
body: <p><strong>Apache Airflow version</strong>:</p>
  <p>2.0.0</p>
  <p><strong>Environment</strong>:</p>
  <ul>
  <li><strong>Cloud provider or hardware configuration</strong>: OpenStack -&gt; VM -&gt; Docker container</li>
  <li><strong>OS</strong> (e.g. from /etc/os-release): Debian GNU/Linux 10 (buster)</li>
  <li><strong>Kernel</strong> (e.g. <code>uname -a</code>): Linux 77f8efd77516 4.4.0-193-generic #224-Ubuntu</li>
  </ul>
  <p><strong>What happened</strong>:</p>
  <p>I am trying to trigger a DAG run via the new stable REST-API <code>1.0.0</code> by using a Java-based client. The Java client is generated from the Airflow OpenAPI specification with OpenAPI generator version <code>5.0.0</code> .</p>
  <p>Custom configurations in my <code>airflow.cfg</code>:</p>
  <pre><code>web_server_host = 0.0.0.0
  web_server_port = 8080
  auth_backend = airflow.api.auth.backend.default
  
  </code></pre>
  <p>In addition I have created one admin user:</p>
  <pre><code>airflow users create \
      --username admin \
      --password secret \
      --firstname john \
      --lastname doe \
      --role Admin \
      --email john.doe@example.com
  </code></pre>
  <p>In Airflow  I have one active DAG <code>demo</code></p>
  <p>I trigger the DAG execution via the java client with the following code snippet:</p>
  <pre><code>ApiClient defaultClient = Configuration.getDefaultApiClient();
  defaultClient.setBasePath(&quot;http://1.2.3.4:8080/api/v1);
  DagRunApi dagRunApi = new DagRunApi(defaultClient);
  DAGRun dagRun = new DAGRun();
  try {
        DAGRun result = dagRunApi.postDagRun(&quot;demo&quot;, dagRun);
  
        LOGGER.debug(result);
  
      } catch (ApiException e) {
        e.printStackTrace();
      }
  
  </code></pre>
  <p>However, I receive the following exception:</p>
  <pre><code>org.openapitools.client.ApiException: FORBIDDEN
      at org.openapitools.client.ApiClient.handleResponse(ApiClient.java:1012)
      at org.openapitools.client.ApiClient.execute(ApiClient.java:925)
      at org.openapitools.client.api.DagRunApi.postDagRunWithHttpInfo(DagRunApi.java:740)
      at org.openapitools.client.api.DagRunApi.postDagRun(DagRunApi.java:715)
      at de.baas.evaluation.scheduler.airflow.ExternalTrigger.triggerDAGRun(ExternalTrigger.java:46)
      at de.baas.evaluation.scheduler.service.BaaSScheduler$1.message(BaaSScheduler.java:60)
      at de.baas.evaluation.scheduler.service.BaaSScheduler$1.message(BaaSScheduler.java:53)
      at io.lettuce.core.pubsub.PubSubEndpoint.notifyListeners(PubSubEndpoint.java:217)
      at io.lettuce.core.pubsub.PubSubEndpoint.notifyMessage(PubSubEndpoint.java:206)
      at io.lettuce.core.pubsub.PubSubCommandHandler.doNotifyMessage(PubSubCommandHandler.java:292)
      at io.lettuce.core.pubsub.PubSubCommandHandler.notifyPushListeners(PubSubCommandHandler.java:223)
      at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:606)
      at io.lettuce.core.pubsub.PubSubCommandHandler.decode(PubSubCommandHandler.java:112)
      at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:560)
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
      at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
      at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
      at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
      at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
      at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
      at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
      at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
      at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
      at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  <p>The Airflow logs do not show any error message.</p>
  <p><strong>What you expected to happen</strong>:</p>
  <p>Previously, I also the outdated experimental REST-API to trigger tasks externally (without a client but using custom REST calls) and it worked without issues.</p>
  <p>With the new stable API it seems that my client does not have sufficient permissions even if the authentication is deactivated via <code>airflow.api.auth.backend.default</code></p>
  <p>But also adding username and password to the client creation via</p>
  <pre><code>defaultClient.setUsername(&quot;admin&quot;);
  defaultClient.setPassword(&quot;secret&quot;);
  </code></pre>
  <p>results in the same error: <code>FORBIDDEN</code></p>
  <p>Do I need to create a dedicated REST-API user and if yes is there any documentation on this topic?</p>
  <p><strong>How to reproduce it</strong>:</p>
  <p>Create the Java client (probably any client will produce this error) via OpenAPI generator:</p>
  <ol>
  <li><code>java -jar codegen/openapi-generator-cli-5.0.0.jar generate -i openapi.yaml -g java  -o .</code></li>
  <li>create a simple java class and apply the code snippets from above</li>
  </ol>