Issue in Auth code grant type Github example

Hi guys, I am trying the Auth code Github example and getting errors, when I pass,

yo oauth-auth-code-grant-sample
Follow the prompts:
Sample Generator of OAuth Authorization Code Grant Type Proxies.
? Your user name:{email}
? Password:{password}
? Management API URL Endpoint:  https://login.apigee.com/login
? Organization Name:{org}
? Environment Name:test
Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
'{org-name}' is not recognized as an internal or external command,
operable program or batch file.
curl: (6) Could not resolve host: application; Host not found
The system cannot find the path specified.
curl: (6) Could not resolve host: application; Host not found
The system cannot find the path specified.
Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.

I am passing correct login info, why am I getting 401?

Solved Solved
0 12 482
1 ACCEPTED SOLUTION

Hi @Barahalikar Siddharth, I just tried this and it worked for me. So I suspect there to be some other problem.

Tip: For the "management api url" question, just hit enter. I will accept the default which is shown in parenthesis and that will work fine.

From the error you have pasted, it looks like apigeetool is not working properly.

1) Could you please update your apigeetool?

$ npm update -g apigeetool

2) Please test apigeetool by fetching all proxy data from your org

$ apigeetool listdeployments -o {orgname} -e {envname} -u {email}

and enter password when prompted.

This should give you revisions of all proxies deployed on your org. This will test that apigeetool works.
If (2) works after you ran the update command in (1), maybe the original problem is fixed. Just try the "yo" command again.



Else let me know what is the error (same or new) and I will look a little more deeper.

View solution in original post

12 REPLIES 12

@Barahalikar Siddharth ,

It's the Management API URL that's resulting in 401.

In above example, Management API should be ,

https://api.enterprise.apigee.com/v1

@Anil Sagar

I have tried your URL and https://api.enterprise.apigee.com/ both give the same error.

Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.
Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
'siddharth1' is not recognized as an internal or external command,
operable program or batch file.
Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
'siddharth1' is not recognized as an internal or external command,
operable program or batch file.
curl: (6) Could not resolve host: application; Host not found
The system cannot find the path specified.
curl: (6) Could not resolve host: application; Host not found
The system cannot find the path specified.
Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.

@Barahalikar Siddharth , You have mentioned 'https://api.enterprise.apigee.com/' , It's wrong. See my answer again, It's 'https://api.enterprise.apigee.com/v1' . You are missing /v1 !!

@Anil Sagar, I said that, I have tried both your URL and the one without /v1, both give same error 🙂

Yep, I read it too fast, Didn't notice and 🙂

Hi @Barahalikar Siddharth, I just tried this and it worked for me. So I suspect there to be some other problem.

Tip: For the "management api url" question, just hit enter. I will accept the default which is shown in parenthesis and that will work fine.

From the error you have pasted, it looks like apigeetool is not working properly.

1) Could you please update your apigeetool?

$ npm update -g apigeetool

2) Please test apigeetool by fetching all proxy data from your org

$ apigeetool listdeployments -o {orgname} -e {envname} -u {email}

and enter password when prompted.

This should give you revisions of all proxies deployed on your org. This will test that apigeetool works.
If (2) works after you ran the update command in (1), maybe the original problem is fixed. Just try the "yo" command again.



Else let me know what is the error (same or new) and I will look a little more deeper.

Hi @Prashanth K S, I have updated apigeetool and can fetch the proxies.

For me the default Management API URL Endpoint is https://api.enterprise.apigee.com

Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.
Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
'siddharth1' is not recognized as an internal or external command,
operable program or batch file.
Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
'siddharth1' is not recognized as an internal or external command,
operable program or batch file.
curl: (6) Could not resolve host: application; Host not found
The system cannot find the path specified.
curl: (6) Could not resolve host: application; Host not found
The system cannot find the path specified.
Error: Get API info returned status 401
'-o' is not recognized as an internal or external command,
operable program or batch file.

Please let me know what default URL you are using.

Yes @Barahalikar Siddharth, the URL is the same for me. This is probably not about the URL issue. The apigeetool call seem to be no recognizing the -o option.

However the 401 indicates that maybe it is an authorization problem. But you said the apigeetool listdeployments command is working fine.

Can you also try to update the yeoman generator? Then let's try again.

$ npm update -g generator-oauth-auth-code-grant-sample

Yeah @Prashanth K S, the apigeetool listdeployments works without any issue. I have also updated yeoman generator. I get the same error.

Hi @Prashanth K S & @Anil Sagar any other solution on this?

@Barahalikar Siddharth everything looks fine. So I think the problem could only be the dev environment from where we are doing things.
Where are you running it from? Which OS? Which Shell?

By any chance are you doing this on Windows? Is it a native cmd, or cygwin shell on windows?

We run this on bash on Mac and Linux and it has worked fine.

I have tried this example after a year and yes the issue was with my operating system. This doesn't work properly on Windows10. Worked fine in a Linux machine.