Reputation: 1326
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
Upvotes: 0
Views: 640
Reputation: 281
if you are new to mobilefirst, and want to refer to sample programs for accessing a protected resource via OAUTH, you can refer samples
For a protected resource access via OAUTH, Please refer to samples https://www.ibm.com/support/knowledgecenter/en/SSHS8R_8.0.0/com.ibm.worklight.dev.doc/dev/c_oauth_custom_resource_request_samples.html
More securitycheck adapters samples for various user scenarios can be found here https://mobilefirstplatform.ibmcloud.com/tutorials/ru/foundation/8.0/authentication-and-security/
Upvotes: 0
Reputation: 2681
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
create a confidential client for the scopes you require
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
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.
Upvotes: 1