Skip to Content
0

HCP IOT MMS: Access to the requested resource is not authorized.

Jul 04, 2017 at 10:29 AM

138

avatar image

Hi,

I am creating a IOT application on HCP. I have 1 message type, 1 device type with OAuth token and 2 devices with OAuth token.

I am using POSTMAN to post HTTP request. I get the following error.

<!DOCTYPE html>
<html>
    <head>
        <title>SAP Cloud Platform IoT Service</title>
        <link rel="stylesheet" type="text/css" href="css/main.css" />
        <style type="text/css"></style>
    </head>
    <body style="background-color: #ffffff;">
        <p>Access to the requested resource is not authorized (HTTP 401).</p>
    </body>
</html>

This is my config

Please share your inputs.

sap-iot.jpg (112.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Anton Levin
Jul 04, 2017 at 09:45 PM
0

Hello Sandeep, by definition you may have only one single "Authorization" header [1] in your HTTP request. Make sure you use one supplied with oath token of your device (not device type token) and check that the HTTP POST url ends with the device ID. Also, be aware that Postman may re-use your browser session, so I suggest to close all browser windows where you have been authenticated with SAML against SAP Cloud Platform (Cockpit etc). Regards, Anton

[1] https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Anton,

Thanks for the response. I have deleted the OAuth token from header for device type and tested with only device. I still get the same error. Attached are the screenshots for your reference.

sap-iot.jpg (119.5 kB)
sap-iot.jpg (119.5 kB)
sap-iot-1.jpg (108.1 kB)
0

You have masked the values on screenshots but just based on their length, I have a feeling you used device id as Bearer and put oauth token to URL. This should be opposite: ../v1/api/http/data/device-id and Bearer oauth-token. Also, check the browser session sspect from my last comment. Regards, Anton

0
Sandeep Kadamb Jul 05, 2017 at 11:30 AM
0

Thanks Anton. You are right. I closed all browsers,cleared cache and history, re-deployed the MMS and voila! it worked.

Thank you once again.

Share
10 |10000 characters needed characters left characters exceeded