Cannot login to an environment using WSO2 apictl tool

Viewed 512

I'm using WSO2 API Controller 3.1.4 and API Manager 3.1.0. First I added an environment using the below command and it was successfully added.

rocky@ProBook-450-G5:/data/wso2-products/apictl-3.1.4-linux-x64/apictl$./apictl add-env -e test \
> --apim https://localhost:9443 \
> --registration https://localhost:9443/client-registration/v0.16/register \
> --token https://localhost:8243/token

Successfully added environment 'test'

Then I tried to login above created test environment using the following command.

rocky@ProBook-450-G5:/data/wso2-products/apictl-3.1.4-linux-x64/apictl$ ./apictl login test -u admin -p admin -k --verbose

For the above command, I received below error response message.

Executed ImportExportCLI (apictl) on Wed, 19 Aug 2020 09:49:15 +0530
[INFO]: Insecure: trueSuccessfully added environment 'test'
Warning: Using --password in CLI is not secure. Use --password-stdin
Getting ClientID, ClientSecret: Status - 404 
Error: %!s(<nil>)
Body: 
Error occurred while login :  Request didn't respond 200 OK: 404 

When I tried client-registration in REST-API , I got a successful 200 response.

Is there any issue in the command that I used to create the environment?

1 Answers

You should add the environment as below according to the documentation [1].

./apictl add-env -e test \
     --apim https://localhost:9443 \
     --registration https://localhost:9443 \
     --token https://localhost:8243/token

You should not specify the registration endpoint as https://localhost:9443/client-registration/v0.16/register. That is for the older versions (APIM 3.0.0 + APICTL 3.0.x [2])

[1] https://apim.docs.wso2.com/en/latest/learn/api-controller/getting-started-with-wso2-api-controller/#add-an-environment

[2] https://apim.docs.wso2.com/en/3.0.0/learn/api-controller/getting-started-with-wso2-api-controller/#add-an-environment

Refer here for a Demo of the above correct use case (Please make sure to remove the environment using "./apictl remove env test" before adding the environment again)

Related