wso2 / product-apim

Welcome to the WSO2 API Manager source code! For info on working with the WSO2 API Manager repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
845 stars 785 forks source link

Doc Feedback: [APIM-3.2.0]- Error 900967 on https://localhost:9443/api/am/store/v1/applications/*/map-keys #9610

Open ollimppio opened 3 years ago

ollimppio commented 3 years ago

Location : https://apim.docs.wso2.com/en/latest/develop/product-apis/devportal-apis/devportal-v1/devportal-v1/

I'm trying to change the values of the consumerKey and consumerSecret as https://apim.docs.wso2.com/en/latest/develop/product-apis/devportal-apis/devportal-v1/devportal-v1/#tag/Application-Keys/paths/~1applications~1{applicationId}~1map-keys/post, but I'm getting an error.

My data.json sample:

{
    "consumerKey": "test_new_consumerKey",
    "consumerSecret": "test_new_consumerSecret",
    "keyManager": "Resident Key Manager",
    "keyType": "PRODUCTION"
}

Curl comand:

curl -k -H "Authorization: Bearer 02556278-cbc6-3734-875a-c1be7b2dabde" -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/am/store/v1/applications/e8faa64d-0c37-463f-bc16-f33d57827012/map-keys"

{"code":900967,"message":"General Error","description":"Server Error Occurred","moreInfo":"","error":[]}

wso2carbon.log:

ID: [-1234] [api/am/store] [2020-12-03 23:42:05,209] ERROR {org.wso2.carbon.apimgt.impl.AbstractKeyManager} - Some thing went wrong while getting OAuth application for given consumer key test_new_consumerKey org.wso2.carbon.apimgt.impl.kmclient.KeyManagerClientException: Received status code: 401 Reason: 
    at org.wso2.carbon.apimgt.impl.kmclient.KMClientErrorDecoder.decode_aroundBody0(KMClientErrorDecoder.java:29)
    at org.wso2.carbon.apimgt.impl.kmclient.KMClientErrorDecoder.decode(KMClientErrorDecoder.java:27)
    at feign.AsyncResponseHandler.handleResponse(AsyncResponseHandler.java:96)
    at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138)
    at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:89)
    at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100)
    at com.sun.proxy.$Proxy493.getApplication(Unknown Source)
    at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.mapOAuthApplication_aroundBody20(AMDefaultKeyManagerImpl.java:427)
    at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.mapOAuthApplication(AMDefaultKeyManagerImpl.java:407)
    at org.wso2.carbon.apimgt.impl.APIConsumerImpl.mapExistingOAuthClient_aroundBody76(APIConsumerImpl.java:2599)
    at org.wso2.carbon.apimgt.impl.APIConsumerImpl.mapExistingOAuthClient(APIConsumerImpl.java:2564)
    at org.wso2.carbon.apimgt.rest.api.store.v1.impl.ApplicationsApiServiceImpl.applicationsApplicationIdMapKeysPost(ApplicationsApiServiceImpl.java:874)
    at org.wso2.carbon.apimgt.rest.api.store.v1.ApplicationsApi.applicationsApplicationIdMapKeysPost(ApplicationsApi.java:278)
    at jdk.internal.reflect.GeneratedMethodAccessor583.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:86)
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:110)
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:75)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:145)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
    at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:119)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:834)

TID: [-1234] [api/am/store] [2020-12-03 23:42:05,212] ERROR {org.wso2.carbon.apimgt.rest.api.util.exception.GlobalThrowableMapper} - org.wso2.carbon.apimgt.api.APIManagementException: Some thing went wrong while getting OAuth application for given consumer key test_new_consumerKey
Mariangela commented 3 years ago

@malinthaprasan , can you please look into this Git issue.

malinthaprasan commented 3 years ago

@Mariangela shall we move this to https://github.com/wso2/product-apim.

@ollimppio It seems there is an authentication failure from the APIM's internal IDP side when trying change the client secret. Do you get the same error when trying other operations like Generate Application Keys (https://apim.docs.wso2.com/en/latest/develop/product-apis/devportal-apis/devportal-v1/devportal-v1/#tag/Application-Keys/paths/~1applications~1{applicationId}~1generate-keys/post) or you are getting this only for Map keys? Do you see any other error log just above the error you posted, if so can you post that too?

ollimppio commented 3 years ago

@malinthaprasan , I getting this error for Map key only.

When tried "Generate Application Keys" it works:

curl -k -H "Authorization: Bearer fbf005ab-f832-349e-a62a-74ea77e13580" -H "Content-Type: application/json" -X POST -d @generatekey "https://localhost:9443/api/am/store/v1/applications/d1420b31-1c01-4e1e-ab27-ae7459101694/generate-keys"

{
  "keyMappingId": "a6772a74-bdec-4da5-8b7d-949e8b272ff9",
  "keyManager": "Resident Key Manager",
  "consumerKey": "dMsvaUTOCn59DfT615_FwZ_22NYa",
  "consumerSecret": "sEKro0gR46SjkXVZWu1H5FWcYNQa",
  "supportedGrantTypes": [
    "password",
    "client_credentials"
  ],
  "callbackUrl": "http://sample.com/callback/url",
  "keyState": "APPROVED",
  "keyType": "PRODUCTION",
  "groupId": null,
  "token": {
    "accessToken": "eyJ4NXQiOiJNell4TW1Ga09HWXdNV0kwWldObU5EY3hOR1l3WW1NNFpUQTNNV0kyTkRBelpHUXpOR00wWkdSbE5qSmtPREZrWkRSaU9URmtNV0ZoTXpVMlpHVmxOZyIsImtpZCI6Ik16WXhNbUZrT0dZd01XSTBaV05tTkRjeE5HWXdZbU00WlRBM01XSTJOREF6WkdRek5HTTBaR1JsTmpKa09ERmtaRFJpT1RGa01XRmhNelUyWkdWbE5nX1JTMjU2IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhZG1pbkBjYXJib24uc3VwZXIiLCJhdWQiOiJkTXN2YVVUT0NuNTlEZlQ2MTVfRndaXzIyTllhIiwibmJmIjoxNjA3NjExMDQ5LCJhenAiOiJkTXN2YVVUT0NuNTlEZlQ2MTVfRndaXzIyTllhIiwic2NvcGUiOiJhbV9hcHBsaWNhdGlvbl9zY29wZSBkZWZhdWx0IiwiaXNzIjoiaHR0cHM6XC9cL2xvY2FsaG9zdDo5NDQzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNjA3NjE0NjQ5LCJpYXQiOjE2MDc2MTEwNDksImp0aSI6IjlkNDVkOTM1LTg2NGYtNDBiNi1hZjMzLTZiYWFkMmNjOTQ2NCJ9.k6O3S21aZM7cf1hti_Eo7qU7pGuxYZJHrnaKOFj-fBcUU5XJ3nFhQXc7w69bJ3C6h0OFzcL7Q10XHZZVcdwG5XiaB2Imi4WNN1p5_hN2rUDwSLxwmSkm-lWLxGN5amOK-TtEFGEy5gX4ZFcmoHn90wTVS9xRFkJ0HbV5EoXg7aeQtXiQntttcxnXz26Gm--dNn3HehIOPlItsU_FwdKnFPoHEpBOOMpS8y5IHLTGdFtFh6uhxNwHRRYg-yKDqh6hD6nUPOhWXV7WTaVhRhtaxp2yERFQ1wIFwtkno8Y49KwuTIYWMTzTCT-kIyaafkGfqg_Un5H1TWTvOMZpwlMfcA",
    "tokenScopes": [
      "am_application_scope",
      "default"
    ],
    "validityTime": 3600
  },
  "additionalProperties": "{}"
}

But when trying change the client secret, isn't work:

curl -k -H "Authorization: Bearer fbf005ab-f832-349e-a62a-74ea77e13580" -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/am/store/v1/applications/d1420b31-1c01-4e1e-ab27-ae7459101694/map-keys"

{
  "code": 900967,
  "message": "General Error",
  "description": "Server Error Occurred",
  "moreInfo": "",
  "error": []
}
[wso2carbon.log](https://github.com/wso2/product-apim/files/5673557/wso2carbon.log)