title: Generating consumer key and consumer secret in WSO2 API Manager
body: <p>I want to integrate the WSO2 API Manager with a website so that the user doesn't need to login to the API Store.</p>
  
  <p>From what I can see there is a stumbling block, in that the user needs to click on the 'Generate' button in the store in order to first generate the consumer key and secret.</p>
  
  <p>Once this has been done then on it is possible to call the subscription API and generate token API as documented:</p>
  
  <pre><code>$ curl -b cookies http://localhost:9763/store/site/blocks/subscription/subscription-list/ajax/subscription-list.jag?action=getAllSubscriptions
  {
     "error" : false,
     "subscriptions" : [
        {
        {
           "sandRegenarateOption" : true,
           "prodKey" : "2486e65cbac4e372fb319375744fb",
           "subscriptions" : [
              {
                 ...
                 "prodConsumerSecret" : "Tx9i9WYu6_a3qqW08bF7jEG660",
                 "prodConsumerKey" : "VfS5r5u4rFhec2vVBlFosxRgcE",
                 "prodAuthorizedDomains" : "ALL"
                 ...
              }
           ],
           ...
           "prodConsumerSecret" : "Tx9i9WYu6_a3qqW08bF7jEG660",
           "prodConsumerKey" : "VfS5r5u4rFhec2vVBlFosxRgcE"
           ...
        }
     ]
  }
  </code></pre>
  
  <p>However until the 'Generate' button has been clicked in the browser, the values above are <code>null</code></p>
  
  <p>When I tried using the suggestion:</p>
  
  <pre><code>$ curl -X POST -b cookies http://localhost:9763/store/site/blocks/subscription/subscription-add/ajax/subscription-add.jag -d "action=generateApplicationKey&amp;application=4&amp;keytype=PRODUCTION&amp;provider=admin&amp;tier=Unlimited&amp;version=0.1&amp;callbackUrl=&amp;authorizedDomains="
  </code></pre>
  
  <p>The server logs:</p>
  
  <pre><code>ERROR - APIStoreHostObject Error while obtaining the application access token for the application:4
  org.wso2.carbon.apimgt.api.APIManagementException: Application should be approved before registering.
      at org.wso2.carbon.apimgt.impl.APIConsumerImpl.requestApprovalForApplicationRegistration(APIConsumerImpl.java:1678)
      at org.wso2.carbon.apimgt.impl.UserAwareAPIConsumer.requestApprovalForApplicationRegistration(UserAwareAPIConsumer.java:34)
      at org.wso2.carbon.apimgt.hostobjects.APIStoreHostObject.jsFunction_getApplicationKey(APIStoreHostObject.java:649)
  </code></pre>
  
  <p>But according to the getApplications API it is approved already:</p>
  
  <pre><code>curl -b cookies   http://localhost:9763/store/site/blocks/application/application-list/ajax/application-list.jag?action=getApplications
  {
     "applications" : [
        ...
        {
           "tier" : "Unlimited",
           "status" : "APPROVED",
           "callbackUrl" : "",
           "name" : "app2",
           "id" : 4,
           "description" : ""
        }
     ],
     "error" : false
  }
  </code></pre>
  
  <p>Any more thoughts ?</p>