oauth-2.0ibm-mobilefirstpostmanmobilefirst-adapters

MobileFirst Adapter obtain OAuth Token


I have a Java Adapter on my MobileFirst Server. I want to obtain an access token from the server in order to call the Adapter-API functions.

I have successfully done this with Postman using "Basic Auth" by giving Username and password (which I had defined in the MFP console before that) as parameters.

Now I want to get a token by using OAuth 2.0 as Type. How can I do this? I do not see any settings for that in the MFP console


Solution

  • You can access the /token endpoint only with Basic Authentication option. /token endpoint does not support accessing with OAuth token instead of Basic Auth .

    The approach you are taking is to access Adapter endpoints from non-MFP SDK methods ( REST clients, Curl etc) .

    When using non-MFP SDK clients, you need to execute the steps manually

    1. create a confidential client for the scopes you require

    2. Invoke the /token endpoint to obtain the token - here you will need to pass on Basic Auth to invoke the endpoint and also the scopes you need

    3. Once you have the OAuth token, you will need to manually add the Authorization header to further requests and add the Bearer Token as the value.