Search code examples
ibm-mobilefirstmobilefirst-adaptersmobilefirst-cli

MobileFirst Adapters - Why am I getting a "401 Unauthorized" error when making request on Swagger Docs page in the MobileFirst Operations Console


I am using MobileFirst CLI 8.0.0-2016070716, Java 1.8.0_91 (on Mac OS X 10.11.6 if it matters). I have been working through this tutorial on creating Java adapters using MobileFirst CLI.

After following the steps on creating, building, and deploying the adapter, I open the operations console and select the adapter I just deployed --> Resources --> "View Swagger Docs". When I press "Try it out" on any of the operations, I receive a "401 - Unauthorized" response code.

Any idea what problem might be?


Solution

  • "To add a Test Token to the request, so that the security framework skips any security challenges protecting your resource, click the on/off switch button on the right corner of an endpoint's operation.

    You will be asked to select which scopes you want to grant to the Swagger UI (for testing purposes, you can select all). If you are using the Swagger UI for the first time, you might be required to log in with a Confidential Client ID and Secret. For this, you will need to create a new confidential client with * as its Allowed Scope."

    Documentation regarding this is located here in our getting started tutorials. https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/adapters/testing-and-debugging-adapters/#using-swagger