Http.agenturl()

…is now available. This allows you to retrieve the agent’s URL from within agent code, useful when you need to send it somewhere.

thanks, I love this

Excellent - just what I needed!

This returns the “http:” version of the agent URL… shouldn’t it return the “https:” one?

Peter

it works

@peter, yes, that appears to be a bug!

I only noticed 'cos I had to change my OAuth2 callback URL…

Peter

Peter OAuth2 is that going to be public soon?

Thanks

We might end up doing something a bit more “built-in” in the future (especially for people needing to commercialise OAuth2 projects), but it is already possible to use OAuth2 directly from an agent. I’m working up an example which will go on the devwiki when it’s a bit more polished.

Peter

I wasn’t aware that the agents could be accessed using http (as opposed to https) which brings up a possible data privacy issue when https is not being used.

Is there currently any way to distinguish if a request to the agent is coming via http or https? Is it possible to disable access via http all together?

Good idea… will add a feature request. Some people care more about latency than security hence the http option.

if someone is sniffing your internet data, you have a much bigger problem than only the imp data flow.

Considering the machinations that our cloud setup has to go through once the messages arrive, I wouldn’t’ve thought anyone could detect the difference in latency between HTTP and HTTPS as the transport. We should just turn off HTTP, IMO.

Peter

In the hardware.agenturl() value, can we depend on the http prefix always being “https://agent.electricimp.com/”? In other words, I am saving the url string in a database and wonder if I can just save the unique token, rather than the whole string.