0
votes

I tried to invoke a protected javascript resource adapter in MFP 8.0 cordova app (with mfp plugin also installed), without any specific security setted. Below the configuration used:

adapter.xml

<?xml version="1.0" encoding="UTF-8"?>
<mfp:adapter name="AccountAdapter"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:mfp="http://www.ibm.com/mfp/integration"
         xmlns:http="http://www.ibm.com/mfp/integration/http">

<displayName>AccountAdapter</displayName>
<description>AccountAdapter</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>https</protocol>
        <domain>mobilefirstplatform.ibmcloud.com</domain>
        <port>443</port>
        <connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
        <socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
        <maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
    </connectionPolicy>
</connectivity>

<procedure name="getUser"/>

javascript app code

var resourceRequest = new WLResourceRequest("adapters/AccountAdapter/getUser", WLResourceRequest.GET);
        resourceRequest.setQueryParameter("params", "[1]");
        resourceRequest.send().then(success, loadFailure);

but the response was

worklight.js:10192 GET http://localhost:6015/mfp/api/adapters/AccountAdapter/getUser?params=%5B1%5D 401 (Unauthorized)

The test was made in Mobile Browser Simulator, for iOS platform.

I remember that, in previous versions of MFP, calls to adapters negotiate automatically the token to access to protected resource.

Is it still possible to do that, without sophisticate the authorization process?

If no, what is necessary to make call to a protected resource?

1

1 Answers

0
votes

Please read the documentation about security: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/authentication-and-security/#disabling-protection

Have you tried disabling security?
In JavaScript adapters add the secured attribute and set its value to false.

For example:

<procedure name="deleteUser" secured="false">