OAuth-advanced sample - yeoman generator working?

Not applicable

Hi,

I would like to know how to setup oauth authorization code grant type, found the oauth_advanced sample but its not working or not sure if I am missing anything.

After running below steps (as per the instructions on github):

  • Call Yeoman: yo oauth-auth-code-grant-sample
  • Follow the prompts:
  • <code>Sample Generator of OAuth Authorization Code Grant Type Proxies.
    ? Your user name:
    ? Password:
    ? Management API URL Endpoint: https://api.enterprise.apigee.com
    ? Organization Name:
    ? Environment Name:

    Will the Yeoman script automatically deploy API Proxies, etc. to Apigee Edge automatically? I do see folders and files created locally but I don't see anything deployed to Apigee Edge.

    And I get "Error: Get API info returned status 401" in the yeoman call console output.

    Below is the output of the yeoman call:

    ? Your user name xxx

    ? Password ********

    ? Management API URL Endpoint https://api.enterprise.apigee.com

    ? Organization Name xxx

    ? Environment Name test

    Error: Get API info returned status 401 Error:

    Get API info returned status 401 using xxx and xxx

    Install API Products

    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    100 335 0 0 100 335 0 2011 --:--:-- --:--:-- --:--:-- 2537

    Create developers % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    100 251 0 0 100 251 0 1429 --:--:-- --:--:-- --:--:-- 1792

    Create apps % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    100 294 0 0 100 294 0 1859 --:--:-- --:--:-- --:--:-- 2352

    Get app info % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    100 121 0 0 100 121 0 726 --:--:-- --:--:-- --:--:-- 923

    npm WARN deprecated less-middleware@0.1.15: Updated API and improved functionality.

    oauth-login-consent@1.0.1 /oauth-sample/login-app/apiproxy/resources/node

    ├─ apigee-access@1.3.0

    ├┬ body-parser@1.15.0

    │ ├── bytes@2.2.0

    │ ├── content-type@1.0.1

    │ ├── debug@2.2.0

    │ ├── depd@1.1.0

    │ ├┬ http-errors@1.4.0

    │ │ ├── inherits@2.0.1

    │ │ └── statuses@1.2.1

    │ ├── iconv-lite@0.4.13

    │ ├─┬ on-finished@2.3.0

    ...

    ...

    ...

    Error: Get API info returned status 401 using xxx and xxx

    Install API Products

    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    100 330 0 0 100 330 0 2088 --:--:-- --:--:-- --:--:-- 2640

    Create developers

    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    100 248 0 0 100 248 0 1510 --:--:-- --:--:-- --:--:-- 1893

    Create apps

    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    100 346 0 0 100 346 0 2195 --:--:-- --:--:-- --:--:-- 2768

    Get app info %

    Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

    100 121 0 0 100 121 0 540 --:--:-- --:--:-- --:--:-- 643

    Error: Get API info returned status 401

    I am assuming the Yeoman call is trying to connect to Apigee Edge but getting 401, Please let me know how to resolve this issue. And if there are any additional steps required to run this example OR Yeoman call is enough?

    Thanks!

    Solved Solved
    1 5 402
    1 ACCEPTED SOLUTION

    Not applicable

    Issue resolved!

    If we use email address as username (instead of username used while registering for Apigee account), it works. Before I was using username in the sample instead of registered email address and it gave 401

    View solution in original post

    5 REPLIES 5

    Dear @Parag Panchal ,

    Welcome to Apigee Community 🙂

    I have tested above OAuth sample & working as expected, you should have Apigee Account to run above tool. It will deploy necessary API Proxy bundles & creates API Products / Apps / Developers in your Apigee Edge Account. If you don't have one, please register here & get an org name to use above tool.

    Do you have Apigee Edge Account ? Are you sure you have provided right Apigee Edge Credentials & org name ? Above errors are due to Invalid Apigee Credentials & OrgName.

    hi @Anil Sagar,

    Yes, I have Apigee Edge account (free version). Will this sample work for free version? I have used respective credentials and OrgName as well.

    Not applicable

    Issue resolved!

    If we use email address as username (instead of username used while registering for Apigee account), it works. Before I was using username in the sample instead of registered email address and it gave 401

    Glad to hear it worked out, @Parag Panchal. Feel free to reach out on here or to me directly (since I worked on the generator) if you have any further questions.

    I am using email address as username still 401 unauthorized, I am on Windows 10(can see one open issue on win10 platform). Were you able to do it on Windows 10?