Including the userid:password (for authentication) in the URL for GETting and POSTing into a protected directory (while still working) has been depreciated, so I’ve been trying to get it to work using custom headers.
The rfc states:
The username and password are combined with a single colon. (check
The resulting string is encoded into an octet sequence.
The resulting string is encoded using a variant of Base64.check
The authorization method and a space is then prepended to the encoded string, separated with a space (e.g. "Basic "). param.header.Authenticate = "Basic " … <b64 string>check
#2 is the problem. I’ve converted the string into a byte table (byte array) with string.byte(<uid:pw>, 1, -1) but am stuck here. mime.b64 wont take the byte table. I’ve also looked at the utf8 plugin but dont see anything that fits there, and what the octet sequence is doing is ensuring a utf-8 string.
Do your username/passwords have non-ASCII characters in them? You should just be able to pass a Lua string to mime.b64 and have it work. I don’t see why step 2 is really needed.
I’m assuming it’s not working. Are you getting an error?
In your listenForSerialNum function why not add:
print( json.prettify( event ) )
You will of course have to require the json library. See what information is coming back from the server. Then look in the console log and see what’s happening.
hostek is hosting it. nothing on the api. Linux server, using, I thought, apache - though the response says its a litespeed - web server. I’m using .htaccess to password protect the php directory, using a cPanel tool to manage the access and password file. I have a support ticket opened with them to see if there is anything special it requires; though they had also pointed me to the rfc wiki. That’s why I wondered if there was a way to see what actual headers were being sent by network.request.
There is a configuration item that will recognize the spaces, but it would cause other issues (Apache failures). I’m trying to find out what those other issues are.
There doesnt happen to be something that I can pass to network.request to tell it to strip spaces in headers is there…
Do your username/passwords have non-ASCII characters in them? You should just be able to pass a Lua string to mime.b64 and have it work. I don’t see why step 2 is really needed.
I’m assuming it’s not working. Are you getting an error?
In your listenForSerialNum function why not add:
print( json.prettify( event ) )
You will of course have to require the json library. See what information is coming back from the server. Then look in the console log and see what’s happening.
hostek is hosting it. nothing on the api. Linux server, using, I thought, apache - though the response says its a litespeed - web server. I’m using .htaccess to password protect the php directory, using a cPanel tool to manage the access and password file. I have a support ticket opened with them to see if there is anything special it requires; though they had also pointed me to the rfc wiki. That’s why I wondered if there was a way to see what actual headers were being sent by network.request.