wso2 / docs-apim

Apache License 2.0
70 stars 395 forks source link

[APIM-3.2.0]-Getting null response when re-generating the application secret via REST API call and syntax issue in the curl command #2320

Closed saranki closed 3 years ago

saranki commented 3 years ago

Description: Issue 1: According to the wso2am-3.2.0 documentation [1] when an application secret re-generate REST call is made, the response gives null values. But the secret is being updated successfully. When testing the application re-generate REST call as mentioned in wso2am-3.1.0 documentation [2] in the wso2am-3.2.0 pack the secret is re-generated and the correct response got retrieved.

[1] https://apim.docs.wso2.com/en/latest/develop/product-apis/devportal-apis/devportal-v1/devportal-v1/#tag/Application-Keys/paths/1applications1{applicationId}1oauth-keys1{keyMappingId}~1regenerate-secret/post

[2] https://apim.docs.wso2.com/en/3.1.0/develop/product-apis/devportal-apis/devportal-v1/devportal-v1/#tag/Application-Keys/paths/1applications1{applicationId}1keys1{keyType}~1regenerate-secret/post

In [1] doc an additional "/" is added in the curl command after v1. This will give the following error.

Request:
curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -H "Content-Type: application/json" -X POST "https://localhost:9443/api/am/store/v1//applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584/regenerate-secret"

Response
ERROR - WebAppAuthenticatorImpl You cannot access API as scope validation failed

The above request should be corrected as follows by removing the additional "/".

Request:
curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -H "Content-Type: application/json" -X POST "https://localhost:9443/api/am/store/v1/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584/regenerate-secret"

Issue 2: Even when executing the corrected request getting a null response. If the related issue https://github.com/wso2/product-apim/issues/9562 is fixed in the product with the same request then no changes are required in the documentation.

In case if the null response issue needs to be fixed by using the wso2am-3.1.0 request [2], then the wso2am-3.2.0 doc [1] needs to be updated with the wso2am-3.1.0 application secret re-generate request curl command.

[1] https://apim.docs.wso2.com/en/latest/develop/product-apis/devportal-apis/devportal-v1/devportal-v1/#tag/Application-Keys/paths/1applications1{applicationId}1oauth-keys1{keyMappingId}~1regenerate-secret/post

[2] https://apim.docs.wso2.com/en/3.1.0/develop/product-apis/devportal-apis/devportal-v1/devportal-v1/#tag/Application-Keys/paths/1applications1{applicationId}1keys1{keyType}~1regenerate-secret/post

Affected Product Version: wso2am-3.2.0

Related Issues: https://github.com/wso2/product-apim/issues/9562

Sarangan0219 commented 3 years ago

Issue-1 has been fixed with https://github.com/wso2/docs-apim/pull/1911. Issue-2 is fixed in the product with https://github.com/wso2-support/carbon-apimgt/pull/2662.

Hence This issue can be closed.