0

Currently working on adding the CheckBoxAPI to our webservice, and itĀ seems to be quite the challenge getting Multi-Step Security Processing to work. I followed the directions found on logi Info's site, however my efforts yield a 401 unauthorized error.

I can remark the two data tables, and it'll just output the two auth tokens, but I can't seem to get them properly passed through. Any guidance would be of great help.

'''xml
<?xml version="1.0" encoding="utf-8"?>
<Report
    ID="CheckBox7"
    >
    <LocalData
        ID="cbAuth"
        >
        <DataLayer
            AcceptType="application/json"
            ConnectionID="API_Auth"
            HttpMethod="POST"
            ID="RESTDataLayer1"
            RemoveNamespace="True"
            Type="REST"
            UrlPath="/.../oauth2/token"
            >
            <HttpBody
                ContentType="application/x-www-form-urlencoded"
                >
                <HttpBodyParams
                    grant_type="password"
                    password="passwordGoesHere"
                    username="UsernameGoesHere"
                />
            </HttpBody>
            <Flattener/>
        </DataLayer>
    </LocalData>
    <SetSessionVariables
        ID="auth"
        >
        <SessionParams
            access_token="@Local.access_token~"
        />
    </SetSessionVariables>
    <Body>
            <DataTable
            ID="dtSurveyList"
            SortArrows="True"
            >
            <DataLayer
                ConnectionID="API_Queries"
                HttpMethod="GET"
                ID="RESTDataLayer2"
                Type="REST"
                UrlPath="/v1/.../survey-list?search_text=%7Bstring%7D&amp;folder_id=%7Bint%7D&amp;is_favorite=%7Bbool%7D&amp;page_size=%7Bint%7D&amp;page_num=%7Bint%7D&amp;status=%7Benum%7D&quot; "
                >
                <Remark>
                    <HttpBody
                        ContentType="application/x-www-form-urlencoded"
                        >
                        <HttpBodyParams
                        access_Token="@Session.authorization~"
                        />
                    </HttpBody>
                </Remark>
                <Flattener/>
            </DataLayer>
            <AutoColumns/>
        </DataTable>
        <Label
            Caption="@Local.access_token~"
        />
        <LineBreak/>
        <Label
            Caption="@Session.access_token~"
        />
        </Body>
        <ideTestParams/>
    </Report>

'''

Expected output should be a table from the api, actual output is a 401 error, I can post the stack trace as well if it'll help. Not very strong when it comes to headers, any help would be great.

1 Answers1

-1

Turned out access_token had to be specified with the 'Bearer' tag, i.e. <HttpBodyParams access_Token="@Session.authorization~" /> </HttpBody>