API Developer
API Connect is a full-featured OAuth 2.0 provider. The OAuth exchange works like any other API call, and thus we treat it as its own API.

In this section, you will create a new OAuth provider API and configure which grant type to use and how it will authenticate user credentials.

Create OAuth API

  1. Return to the API Connect Toolkit tab in your browser.

  2. Make sure you are still in the inventory project.

    Click on the menu icon in the upper left-hand corner of the screen, expand the Projects option and select inventory.

  3. Click the + Add button and select OAuth 2.0 Provider API from the menu.

  4. Specify the following properties and click the Create API button to continue.

    Title: oauth

    Name: oauth

    Base Path: /

    Version: 1.0.0

  5. The API Editor will launch. If this is your first time using the API Editor, you will see an informational message. When you are ready to proceed, click the Got it! button to dismiss the message.

    The API Editor opens to the newly created oauth API. The left hand side of the view provides shortcuts to various elements within the API definition: Info, Host, Base Path, etc. By default, the API Editor opens to the Design view, which provides a user-friendly way to view and edit your APIs.

  6. Use the palette on the left to navigate to the OAuth 2 section.

    Over the next several steps, we will set up OAuth-specific options, such as client type (public vs confidential), valid access token scopes, supported authorization grant types, etc. The OAuth 2.0 Specification has detailed descriptions of each of the properties we are configuring here.

  7. For the Client type field, click the drop down menu and select Confidential.

  8. Three scopes were generated for you when the OAuth API Provider was generated: scope1, scope2, scope3.

  9. Modify the values for scope1, set the following fields:

    Name: inventory

    Description: Access to Inventory API

    Delete scope2 and scope3 by clicking the trashcan icons to the right of the scope definitions.

  10. We want to configure this provider to only support the Resource Owner Password Credentials grant type. Deselect the Implicit, Application and Access Code Grants, but leave Password checked.

  11. In the Identity extraction section, set the Collect credentials using drop-down menu to Basic.

  12. In the Authentication section, set the following fields:

    Authenticate application users using: Authentication URL

    Authentication URL: https://thinkibm-services.mybluemix.net/auth

  13. Scroll down to the Tokens section, turn off the Enable revocation option.

  14. Click the Save icon in the top right corner of the editor to save your changes.

  15. Click on the <- All APis link to return to the draft API list.

Continue

Proceed to Create a New Version of the Inventory API.