Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

http get req


tortho
 Share

Question

What am I doing wrong, below code gives:

[16.05.2021] [23:48:27] [DEBUG] [QUICKAPP730]: response status: 400[16.05.2021] [23:48:27] [DEBUG] [QUICKAPP730]: headers: text/html; charset=UTF-8

 

 

 
function QuickApp:setupToken()
    local address = "https://interop.ondilo.com/oauth2/authorize"
    self.http:request(address, {
        options={
            headers = {
                ["Accept"] = "application/json",
                ["Accept-Charset"] = "UTF-8",
                ["Accept-Encoding"] = "gzip-deflate",
                ["Content-type"] = "application/json"
            },
            method = 'GET'
        },
        success = function(response)
            self:debug("response status:", response.status) 
            self:debug("headers:", response.headers["Content-Type"]) 
            local data = json.decode(response.data)  
            if data.contents and data.contents.quotes and data.contents.quotes[1] then
                local quote = data.contents.quotes[1].quote
                self:debug(quote)
                self:updateView("label", "text", quote) 
            end
        end,
        error = function(error)
            self:debug('error: ' .. json.encode(error))
        end
    }) 
end
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I don't know much about oauth(2) but I can tell you this... If you go to 

Please login or register to see this link.

 you get 400 which means "400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing)."

 

If you then look at the body it says: "{"error":"invalid_client","error_description":"No client id supplied"}"

 

Yeah, shouldn't you have more headers or parameters? I don't know.

 

That's my 1 cent contribution, sometimes that is enough to get people going... ;)

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thank you @petergebruers for the swift reply.

     

    Please login or register to see this link.

    is my goal but I cant figure out how to include the missing pieces (parameters) to get this working..

    but learning by searching and doing, so I'll try to find some more topics to cut and paste from :-)

     

     

    Request

    Method GET
    URL

    Please login or register to see this link.

    Parameters

    client_id customer_api
    response_type code
    redirect_uri The Ondilo authorization service will redirect the user back to your application whether the user successfully authorized your application or denied access.
    scope api
    state An anti-forgery token provided by your application.
    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

     Share

    ×
    ×
    • Create New...