cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member226234
Contributor
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

anton_levin
Advisor
Advisor
0 Kudos

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

former_member226234
Contributor
0 Kudos

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.

anton_levin
Advisor
Advisor
0 Kudos

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

Answers (1)

Answers (1)

former_member226234
Contributor
0 Kudos

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.